Class: Spree::TaxonRules::Sale

Inherits:
Spree::TaxonRule show all
Defined in:
app/models/spree/taxon_rules/sale.rb

Constant Summary

Constants inherited from Spree::TaxonRule

Spree::TaxonRule::MATCH_POLICIES

Instance Method Summary collapse

Instance Method Details

#apply(scope) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'app/models/spree/taxon_rules/sale.rb', line 4

def apply(scope)
  case match_policy
  when 'is_equal_to' || 'contains'
    scope.on_sale(store.default_currency)
  when 'is_not_equal_to' || 'does_not_contain'
    scope.where.not(id: scope.on_sale(store.default_currency))
  else
    scope
  end
end