Fix assignment with if

This commit is contained in:
Hernan Schmidt 2017-07-12 17:05:48 +02:00
parent 9b362db98e
commit 60569d5ec0
5 changed files with 31 additions and 31 deletions

View file

@ -29,11 +29,11 @@ class TicketPurchase < ActiveRecord::Base
conference.tickets.each do |ticket|
quantity = purchases[ticket.id.to_s].to_i
# if the user bought the ticket and is still unpaid, just update the quantity
if ticket.bought?(user) && ticket.unpaid?(user)
purchase = update_quantity(conference, quantity, ticket, user)
else
purchase = purchase_ticket(conference, quantity, ticket, user)
end
purchase = if ticket.bought?(user) && ticket.unpaid?(user)
update_quantity(conference, quantity, ticket, user)
else
purchase_ticket(conference, quantity, ticket, user)
end
if purchase && !purchase.save
errors.push(purchase.errors.full_messages)