Class: Administrate::Search
- Inherits:
-
Object
- Object
- Administrate::Search
- Defined in:
- lib/administrate/search.rb
Instance Method Summary collapse
-
#initialize(scoped_resource, dashboard_class, term) ⇒ Search
constructor
A new instance of Search.
- #run ⇒ Object
Constructor Details
#initialize(scoped_resource, dashboard_class, term) ⇒ Search
Returns a new instance of Search.
6 7 8 9 10 |
# File 'lib/administrate/search.rb', line 6 def initialize(scoped_resource, dashboard_class, term) @dashboard_class = dashboard_class @scoped_resource = scoped_resource @term = term end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/administrate/search.rb', line 12 def run if @term.blank? @scoped_resource.all else @scoped_resource.joins(tables_to_join).where(query, *search_terms) end end |