Module: Toolbox::Searching::ControllerClassMethods

Defined in:
lib/toolbox/searching.rb

Instance Method Summary collapse

Instance Method Details

#search_fields(*fields) ⇒ Object

Defines the search fields Example:

search_field :firstname, :lastname, :address

If symbols are given, the model is determined using the controllers name. If you want to search in associated tables, use this format:

search_fields :firstname, :lastname, 'orders.desc'


57
58
59
# File 'lib/toolbox/searching.rb', line 57

def search_fields *fields
  write_inheritable_attribute('search_fields', Toolbox::WidgetList.new(controller_name.singularize, fields, Toolbox::FieldConfig))
end