Module Searchlogic::RailsHelpers
In: lib/searchlogic/rails_helpers.rb

Methods

fields_for   form_for   order  

Public Instance methods

Automatically adds an "order" hidden field in your form to preserve how the data is being ordered.

Automatically makes the form method :get if a Searchlogic::Search and sets the params scope to :search

Creates a link that alternates between acending and descending. It basically alternates between calling 2 named scopes: "ascend_by_*" and "descend_by_*"

By default Searchlogic gives you these named scopes for all of your columns, but if you wanted to create your own, it will work with those too.

Examples:

  order @search, :by => :username
  order @search, :by => :created_at, :as => "Created"

This helper accepts the following options:

  • :by - the name of the named scope. This helper will prepend this value with "ascend_by_" and "descend_by_"
  • :as - the text used in the link, defaults to whatever is passed to :by
  • :ascend_scope - what scope to call for ascending the data, defaults to "ascend_by_:by"
  • :descend_scope - what scope to call for descending the data, defaults to "descend_by_:by"
  • :params - hash with additional params which will be added to generated url
  • :params_scope - the name of the params key to scope the order condition by, defaults to :search

[Validate]