Module: CasedHelper
- Defined in:
- app/helpers/cased_helper.rb
Instance Method Summary collapse
-
#guarded_parameters(form) ⇒ Object
Guarded parameters are the original parameters when the form was first submitted.
- #render_guarded_parameters(form, form_params, prefix = nil) ⇒ Object
Instance Method Details
#guarded_parameters(form) ⇒ Object
Guarded parameters are the original parameters when the form was first submitted. These parameters need to be preserved.
6 7 8 9 10 |
# File 'app/helpers/cased_helper.rb', line 6 def guarded_parameters(form) form_params = params.except(:authenticity_token, :controller, :action) safe_join render_guarded_parameters(form, form_params.to_unsafe_h) end |
#render_guarded_parameters(form, form_params, prefix = nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/cased_helper.rb', line 12 def render_guarded_parameters(form, form_params, prefix = nil) form_params.collect do |key, value| case value when Hash render_guarded_parameters(form, value, key) else name = prefix ? "#{prefix}[#{key}]" : key hidden_field_tag(name, value) end end end |