Module: SolidusLegacyPromotions::SpreeProductDecorator

Defined in:
app/decorators/solidus_legacy_promotions/models/spree_product_decorator.rb

Class Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



5
6
7
8
9
10
11
12
# File 'app/decorators/solidus_legacy_promotions/models/spree_product_decorator.rb', line 5

def self.prepended(base)
  base.has_many :product_promotion_rules, dependent: :destroy
  base.has_many :promotion_rules, through: :product_promotion_rules

  base.after_discard do
    self.product_promotion_rules = []
  end
end