Module: ShopDiscounts::Models::ShopProduct
- Defined in:
- lib/shop_discounts/models/shop_product.rb
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/shop_discounts/models/shop_product.rb', line 5 def self.included(base) base.class_eval do after_create :assign_discounts # Assigns discounts based off categories discounts def assign_discounts category.discounts.each do |discount| ShopDiscountable.create(:discount => discount, :discounted => self) end end end end |