Class: Wallaby::ActiveRecord::ModelOperator::Querier
- Inherits:
-
Object
- Object
- Wallaby::ActiveRecord::ModelOperator::Querier
- Defined in:
- lib/adaptors/wallaby/active_record/model_operator/querier.rb
Instance Method Summary collapse
-
#initialize(model_decorator) ⇒ Querier
constructor
A new instance of Querier.
- #search(params) ⇒ Object
Constructor Details
#initialize(model_decorator) ⇒ Querier
Returns a new instance of Querier.
2 3 4 5 |
# File 'lib/adaptors/wallaby/active_record/model_operator/querier.rb', line 2 def initialize(model_decorator) @model_decorator = model_decorator @model_class = @model_decorator.model_class end |
Instance Method Details
#search(params) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/adaptors/wallaby/active_record/model_operator/querier.rb', line 7 def search(params) text_keywords, field_keywords = extract params query = @model_class.where nil query = text_search text_keywords, query query = field_search field_keywords, query query end |