module Ransack::Helpers::FormHelper
def search_form_for(record, options = {}, &proc)
<%= search_form_for(@q) do |f| %>
+search_form_for+
def search_form_for(record, options = {}, &proc) if record.is_a? Ransack::Search search = record options[:url] ||= polymorphic_path( search.klass, format: options.delete(:format) ) elsif record.is_a?(Array) && (search = record.detect { |o| o.is_a?(Ransack::Search) }) options[:url] ||= polymorphic_path( options_for(record), format: options.delete(:format) ) else raise ArgumentError, 'No Ransack::Search object was provided to search_form_for!' end options[:html] ||= {} html_options = { class: html_option_for(options[:class], search), id: html_option_for(options[:id], search), method: :get } options[:as] ||= Ransack.options[:search_key] options[:html].reverse_merge!(html_options) options[:builder] ||= FormBuilder form_for(record, options, &proc) end