Sha256: 3a10d69f612fb907f042d2a83d02ab2ed742e9771720f087d73f3b0ffa363d12

Contents?: true

Size: 305 Bytes

Versions: 10

Compression:

Stored size: 305 Bytes

Contents

Spree::Product.class_eval do
  has_and_belongs_to_many :promotion_rules, :join_table => 'spree_products_promotion_rules'

  def possible_promotions
    all_rules = promotion_rules
    promotion_ids = all_rules.map(&:activator_id).uniq
    Spree::Promotion.advertised.where(:id => promotion_ids)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_promo-1.1.6 app/models/spree/product_decorator.rb
spree_promo-1.1.5 app/models/spree/product_decorator.rb
spree_promo-1.1.4 app/models/spree/product_decorator.rb
spree_promo-1.1.3 app/models/spree/product_decorator.rb
spree_promo-1.1.2 app/models/spree/product_decorator.rb
spree_promo-1.1.2.rc1 app/models/spree/product_decorator.rb
spree_promo-1.1.1 app/models/spree/product_decorator.rb
spree_promo-1.1.0 app/models/spree/product_decorator.rb
spree_promo-1.1.0.rc2 app/models/spree/product_decorator.rb
spree_promo-1.1.0.rc1 app/models/spree/product_decorator.rb