-
Notifications
You must be signed in to change notification settings - Fork 332
Search Overrides
scambra edited this page Sep 14, 2010
·
21 revisions
If you want to customize the search form interface for a column, you can define a specially named method in your helper file. The format is #{column_name}_search_column. So, for example, to customize the :username column displayed on your search view of UsersController, you would add a :username_search_column method to your UsersHelper file. If you want the post to be handled by ActiveScaffold, you need to use the params[:search] namespace. With the helper override this is taken care of if you use the second argument: the input name. See the example below for more details.
Example:
module UsersHelper
- display the “status” field as a dropdown with open and closed options
def status_search_column(record, input_name)
select :record, :status, options_for_select([‘open’, ‘closed’]), {:include_blank => as_(‘- select -’)}, :name => input_name
end
end