Module: RailsConditionalParams::PrependPatch
- Defined in:
- lib/rails_conditional_params/prepend_patch.rb
Instance Method Summary collapse
-
#permit(*filters) ⇒ Object
Adds support for conditional params:.
Instance Method Details
#permit(*filters) ⇒ Object
Adds support for conditional params:
params.permit(yes: true, no: false)
# => { "yes" => "..." }
This is useful for parameters that should be permitted in some cases, but not others:
params.permit(:title, :body, published: admin?)
# Result only includes published if admin? is true.
13 14 15 16 |
# File 'lib/rails_conditional_params/prepend_patch.rb', line 13 def permit(*filters) RailsConditionalParams.restructure_filters! filters super(*filters) end |