Module: Searchlogic::FormHelper
- Defined in:
- lib/searchlogic/rails_helpers.rb
Instance Method Summary collapse
-
#fields_for_with_searchlogic(*args, &block) ⇒ Object
Automatically adds an “order” hidden field in your form to preserve how the data is being ordered.
-
#form_for_with_searchlogic(*args, &block) ⇒ Object
Automatically makes the form method :get if a Searchlogic::Search and sets the params scope to :search.
Instance Method Details
#fields_for_with_searchlogic(*args, &block) ⇒ Object
Automatically adds an “order” hidden field in your form to preserve how the data is being ordered.
71 72 73 74 75 76 77 |
# File 'lib/searchlogic/rails_helpers.rb', line 71 def fields_for_with_searchlogic(*args, &block) if search_obj = args.find { |arg| arg.is_a?(Searchlogic::Search) } args.unshift(:search) if args.first == search_obj concat(content_tag("div", hidden_field_tag("#{args.first}[order]", search_obj.order))) end fields_for_without_searchlogic(*args, &block) end |
#form_for_with_searchlogic(*args, &block) ⇒ Object
Automatically makes the form method :get if a Searchlogic::Search and sets the params scope to :search
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/searchlogic/rails_helpers.rb', line 57 def form_for_with_searchlogic(*args, &block) if search_obj = args.find { |arg| arg.is_a?(Searchlogic::Search) } = args. [:html] ||= {} [:html][:method] ||= :get [:url] ||= url_for args.unshift(:search) if args.first == search_obj args << end form_for_without_searchlogic(*args, &block) end |