app/models/promotion.rb in spree_promo-0.70.3 vs app/models/promotion.rb in spree_promo-0.70.4

- old
+ new

@@ -10,11 +10,11 @@ [:usage_limit, :match_policy, :code, :advertise].each do |field| alias_method field, "preferred_#{field}" alias_method "#{field}=", "preferred_#{field}=" end - + has_many :promotion_rules, :foreign_key => 'activator_id', :autosave => true, :dependent => :destroy alias_method :rules, :promotion_rules accepts_nested_attributes_for :promotion_rules has_many :promotion_actions, :foreign_key => 'activator_id', :autosave => true, :dependent => :destroy @@ -85,10 +85,10 @@ def usage_limit_exceeded? preferred_usage_limit.present? && preferred_usage_limit > 0 && credits_count >= preferred_usage_limit end def credits - Adjustment.where(:originator_id => actions.map(&:id)) + Adjustment.where(:originator_type => 'Promotion', :originator_id => actions.map(&:id)) end def credits_count credits.count end