Module: ParamsKeeper::Helper
- Defined in:
- lib/params_keeper/helper.rb
Instance Method Summary collapse
Instance Method Details
#form_with(**options, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/params_keeper/helper.rb', line 11 def form_with(**, &block) return super unless controller return super if [:method].to_s.downcase != 'get' html = super = [:url] || [:model] hidden_fields = ParamsKeeper::HiddenFields.new(controller, ).call if hidden_fields.present? html.sub(/^(<form[^>]*>)/) { "#{$1}#{hidden_fields}" }.html_safe else html end end |
#url_for(url_options = nil) ⇒ Object
5 6 7 8 9 |
# File 'lib/params_keeper/helper.rb', line 5 def url_for( = nil) return super unless controller ParamsKeeper::UrlFor.new(self, controller, ).call || super end |