Sha256: 3013869678b5322457ba0e6c5799fac962859cf216aab210ef2a869fa1ac3800

Contents?: true

Size: 297 Bytes

Versions: 9

Compression:

Stored size: 297 Bytes

Contents

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

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

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
spree_promo-1.2.5 app/models/spree/product_decorator.rb
spree_promo-1.2.4 app/models/spree/product_decorator.rb
spree_promo-1.2.3 app/models/spree/product_decorator.rb
spree_promo-1.3.1 app/models/spree/product_decorator.rb
spree_promo-1.3.0 app/models/spree/product_decorator.rb
spree_promo-1.3.0.rc2 app/models/spree/product_decorator.rb
dup_spree_promo-1.3.0.rc1 app/models/spree/product_decorator.rb
spree_promo-1.3.0.rc1 app/models/spree/product_decorator.rb
spree_promo-1.2.2 app/models/spree/product_decorator.rb