Class: Tenon::GenericFilterer
- Inherits:
-
BaseFilterer
- Object
- BaseFilterer
- Tenon::GenericFilterer
- Defined in:
- app/filterers/tenon/generic_filterer.rb
Overview
Returns an ActiveRecord::Collection
filtered based on the presence of params and the quick_search_fields passed into the initializer
quick_search_fields should be an array of strings including table name eg. ['title', 'description']
Instance Attribute Summary
Attributes inherited from BaseFilterer
Instance Method Summary collapse
- #filter ⇒ Object
-
#initialize(scope, params, quick_search_fields) ⇒ GenericFilterer
constructor
A new instance of GenericFilterer.
Constructor Details
#initialize(scope, params, quick_search_fields) ⇒ GenericFilterer
Returns a new instance of GenericFilterer.
7 8 9 10 |
# File 'app/filterers/tenon/generic_filterer.rb', line 7 def initialize(scope, params, quick_search_fields) @quick_search_fields = quick_search_fields super(scope, params) end |
Instance Method Details
#filter ⇒ Object
12 13 14 15 |
# File 'app/filterers/tenon/generic_filterer.rb', line 12 def filter quick_search if params[:q].present? scope end |