lib/ransack/helpers/form_helper.rb in ransack-1.2.2 vs lib/ransack/helpers/form_helper.rb in ransack-1.2.3
- old
+ new
@@ -3,14 +3,17 @@
module FormHelper
def search_form_for(record, options = {}, &proc)
if record.is_a?(Ransack::Search)
search = record
- options[:url] ||= polymorphic_path(search.klass)
+ 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(
- record.map { |o| o.is_a?(Ransack::Search) ? o.klass : o }
+ record.map { |o| o.is_a?(Ransack::Search) ? o.klass : o },
+ format: options.delete(:format)
)
else
raise ArgumentError,
"No Ransack::Search object was provided to search_form_for!"
end