module ParamsKeeper::Helper

Public Instance Methods

form_with(**options, &block) click to toggle source
Calls superclass method
# File lib/params_keeper/helper.rb, line 9
def form_with(**options, &block)
  return super unless controller
  return super if options[:method].to_s.downcase != 'get'

  html = super
  url_options = options[:url] || options[:model]
  hidden_fields = ParamsKeeper::HiddenFields.new(controller, url_options).call
  if hidden_fields.present?
    html.sub('</form>') { "#{hidden_fields}</form>" }.html_safe
  else
    html
  end
end
url_for(url_options = nil) click to toggle source
Calls superclass method
# File lib/params_keeper/helper.rb, line 3
def url_for(url_options = nil)
  return super unless controller

  ParamsKeeper::UrlFor.new(self, controller, url_options).call || super
end