Class: ParamsKeeper::HiddenFields
- Inherits:
-
Object
- Object
- ParamsKeeper::HiddenFields
- Defined in:
- lib/params_keeper/hidden_fields.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(controller, url_options) ⇒ HiddenFields
constructor
A new instance of HiddenFields.
Constructor Details
#initialize(controller, url_options) ⇒ HiddenFields
Returns a new instance of HiddenFields.
5 6 7 8 |
# File 'lib/params_keeper/hidden_fields.rb', line 5 def initialize(controller, ) @controller = controller @url_options = end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/params_keeper/hidden_fields.rb', line 10 def call return if @controller.class.keep_params_configs.blank? params = ParamsKeeper::Resolver.new(@controller, @url_options).call return if params.blank? CGI.parse(params.to_query).flat_map do |key, values| values.map { |value| @controller.view_context.hidden_field_tag(key, value, id: nil) } end.join.html_safe end |