Greg!
I had the same question, but after all I found, that its not appropriate question.
Look, here is the source code of require method in strong_parameters
gem:
def require(key)
self[key].presence || raise(ActionController::ParameterMissing.new(key))
end
So, basically, there is no way to require "required" attribute in params hash. But look on it from different side. I think its better write your own require method in order to do that. Since I'm using rails, I just added validates_presence_of
to the model. If you want to make it dynamic, you may create custom validation. You can find its documentation here: