Skip to content

Instantly share code, notes, and snippets.

@elight
Created February 10, 2015 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elight/9d94a3a33a79a64bc787 to your computer and use it in GitHub Desktop.
Save elight/9d94a3a33a79a64bc787 to your computer and use it in GitHub Desktop.
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