I'm trying to use...
params.require(:subscriber).permit(:utm_source, :utm_medium, :utm_campaign, :utm_term, :utm_content)
The problem is there are rare occasions where I want to do:
Subscriber.new(subscriber_params)
And I don't care if all the values are empty... When I do this it raises ActionController::ParameterMissing
So what I need is a way to make require()
"optional" but still use it for the benefit of restricting nested parameters and for security, so people can't add in {admin: true}
and things like that...
The actual params hash looks like:
{subscriber: {utm_source: 1, ...}
I can't change that part because it's used in many other places of the app. It's just this one spot.