app/models/discount.rb in artfully_ose-1.2.0 vs app/models/discount.rb in artfully_ose-1.3.0.pre1
- old
+ new
@@ -116,10 +116,10 @@
private
def ensure_discount_is_allowed
raise "Discount is not active." unless self.active?
- raise "Discount won't work for this show." unless @cart.tickets.first.try(:event) == self.event
+ raise "Discount won't work for this show." unless @cart.tickets.each{|t| t.try(:event) == self.event}.present?
raise "You need at least #{self.minimum_ticket_count} tickets for this discount." unless @cart.tickets.count >= self.minimum_ticket_count
raise "Discount not valid for these shows or tickets." unless eligible_tickets.count > 0
raise "Discount has been maxed out." unless tickets_fit_within_limit
end