Class: SpreeCmCommissioner::Places::FindWithRoute
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::Places::FindWithRoute
- Defined in:
- app/finders/spree_cm_commissioner/places/find_with_route.rb
Instance Attribute Summary collapse
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#place_type ⇒ Object
readonly
Returns the value of attribute place_type.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(keyword:, place_type:) ⇒ FindWithRoute
constructor
A new instance of FindWithRoute.
Constructor Details
#initialize(keyword:, place_type:) ⇒ FindWithRoute
Returns a new instance of FindWithRoute.
21 22 23 24 |
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 21 def initialize(keyword:, place_type:) @keyword = keyword @place_type = place_type end |
Instance Attribute Details
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
19 20 21 |
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 19 def keyword @keyword end |
#place_type ⇒ Object (readonly)
Returns the value of attribute place_type.
19 20 21 |
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 19 def place_type @place_type end |
Instance Method Details
#execute ⇒ Object
26 27 28 29 30 |
# File 'app/finders/spree_cm_commissioner/places/find_with_route.rb', line 26 def execute return SpreeCmCommissioner::Place.none if keyword.blank? || place_type.blank? scope.where('cm_places.name ILIKE ?', "%#{keyword}%") end |