Skip to content

Instantly share code, notes, and snippets.

@elight

elight/parameters.rb

Created Feb 10, 2015
Embed
What would you like to do?
def require(key)
self[key].presence || raise(ActionController::ParameterMissing.new(key))
end
alias :required :require
def permit(*filters)
params = self.class.new
filters.each do |filter|
case filter
when Symbol, String
permitted_scalar_filter(params, filter)
when Hash then
hash_filter(params, filter)
end
end
unpermitted_parameters!(params) if self.class.action_on_unpermitted_parameters
params.permit!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment