Sha256: cc52d2e609ed99525bfce0d4206f586c75a4d4c6025babbc831442f13ce48464

Contents?: true

Size: 394 Bytes

Versions: 3

Compression:

Stored size: 394 Bytes

Contents

# frozen_string_literal: true

module SolidusLegacyPromotions
  module SpreeProductDecorator
    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

    ::Spree::Product.prepend self
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solidus_legacy_promotions-4.4.2 app/decorators/solidus_legacy_promotions/models/spree_product_decorator.rb
solidus_legacy_promotions-4.4.1 app/decorators/solidus_legacy_promotions/models/spree_product_decorator.rb
solidus_legacy_promotions-4.4.0 app/decorators/solidus_legacy_promotions/models/spree_product_decorator.rb