Class: Wallaby::ActiveRecord::ModelOperator::Querier

Inherits:
Object
  • Object
show all
Defined in:
lib/adaptors/wallaby/active_record/model_operator/querier.rb

Instance Method Summary collapse

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