Class: Spree::PriceRules::MarketRule
Class Method Summary
collapse
Instance Method Summary
collapse
human_name, registered_subclasses
Class Method Details
.description ⇒ Object
29
30
31
|
# File 'app/models/spree/price_rules/market_rule.rb', line 29
def self.description
'Apply pricing based on the market'
end
|
Instance Method Details
#applicable?(context) ⇒ Boolean
21
22
23
24
25
26
27
|
# File 'app/models/spree/price_rules/market_rule.rb', line 21
def applicable?(context)
return false unless context.market
return true if preferred_market_ids.empty?
preferred_market_ids.map(&:to_s).include?(context.market.id.to_s)
end
|
#markets ⇒ Object
15
16
17
18
19
|
# File 'app/models/spree/price_rules/market_rule.rb', line 15
def markets
return [] if preferred_market_ids.blank?
Spree::Market.where(id: preferred_market_ids)
end
|