Class: Spree::PriceRules::ChannelRule
Class Method Summary
collapse
Instance Method Summary
collapse
human_name, registered_subclasses
Class Method Details
.description ⇒ Object
31
32
33
|
# File 'app/models/spree/price_rules/channel_rule.rb', line 31
def self.description
Spree.t('price_rules.channel_rule.description')
end
|
Instance Method Details
#applicable?(context) ⇒ Boolean
21
22
23
24
25
26
27
28
29
|
# File 'app/models/spree/price_rules/channel_rule.rb', line 21
def applicable?(context)
return true if preferred_channel_ids.empty?
return false unless context.channel
preferred_channel_ids.map(&:to_s).include?(context.channel.id.to_s)
end
|
#channels ⇒ Object
15
16
17
18
19
|
# File 'app/models/spree/price_rules/channel_rule.rb', line 15
def channels
return [] if preferred_channel_ids.blank?
store.channels.where(id: preferred_channel_ids)
end
|