Class: FindPointsWithTagStrategy
- Inherits:
-
QueryStrategy
- Object
- QueryStrategy
- FindPointsWithTagStrategy
- Defined in:
- lib/needle_in_a_haystack/strategies/find_point_by_tag_strategy.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(model, tag) ⇒ FindPointsWithTagStrategy
constructor
A new instance of FindPointsWithTagStrategy.
Constructor Details
#initialize(model, tag) ⇒ FindPointsWithTagStrategy
Returns a new instance of FindPointsWithTagStrategy.
2 3 4 5 6 |
# File 'lib/needle_in_a_haystack/strategies/find_point_by_tag_strategy.rb', line 2 def initialize(model, tag) super() @model = model @tag = tag end |
Instance Method Details
#execute ⇒ Object
8 9 10 |
# File 'lib/needle_in_a_haystack/strategies/find_point_by_tag_strategy.rb', line 8 def execute @model.joins(:haystack_tags).where(haystack_tags: { id: @tag.id }) end |