Class: Spree::PriceRules::ChannelRule
Overview
Grandfathered (2026-08-30, one-question-per-entity doctrine): kept
working, but nothing new builds on it — the forward path for channel
pricing is the channel's default catalog owning a price list.
Class Method Summary
collapse
Instance Method Summary
collapse
contextual?, #contextual?, human_name, superseded?
Class Method Details
.description ⇒ Object
31
32
33
|
# File 'app/models/spree/price_rules/channel_rule.rb', line 31
def self.description
I18n.t('spree.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
|