app/models/line_item.rb in trollied-0.1.2 vs app/models/line_item.rb in trollied-0.1.3

- old
+ new

@@ -4,9 +4,13 @@ delegate :description_for_purchasing, :to => :purchasable_item delegate :user, :to => :order + # this is deprecated in Rails 3x, find workaround + # an observer seemed like overkill and would have 3x compatibility stuff todo anyway + after_destroy { |record| record.order.line_item_destroyed } + # needs to be unique to orders that are current (but not unique to orders generally) # validates_uniqueness_of :order_id, :scope => [:purchasable_item_type, :purchasable_item_id] def validate errors.add(:order, I18n.t('line_item.already_in_order')) if !order.current? && !order.in_process? && order.contains?(purchasable_item) end