Module: Glue::Searchable::ClassMethods
- Defined in:
- lib/glue/searchable.rb
Instance Method Summary collapse
-
#search(query) ⇒ Object
Override this method in your class to customize the search.
Instance Method Details
#search(query) ⇒ Object
Override this method in your class to customize the search. This is a nice default method.
16 17 18 19 20 |
# File 'lib/glue/searchable.rb', line 16 def search(query) search_props = properties.values.select { |p| p.searchable } condition = search_props.collect { |p| "#{p} LIKE '%#{query}%'" }.join(' OR ') all(:condition => condition) end |