Skip to content

Commit

Permalink
changed update_attributes! to update_attribute in Order#finalize!, si…
Browse files Browse the repository at this point in the history
…nce the former resets ActiveModel::Errors object, which had just recorded the fact that the payment failed.
  • Loading branch information
armandofox committed Jun 13, 2022
1 parent fc50b5f commit 0545862
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def finalize!(sold_on_date = Time.current)
self.update_attributes!(:authorization => Order::PENDING) # this is a transaction, and also sets updated_at for StaleOrderSweeper
if purchase_medium == :credit_card
unless (auth = Store::Payment.pay_with_credit_card(self))
self.update_attributes!(:authorization => nil) # reset order to not-pending state
self.update_attribute(:authorization, nil) # reset order to not-pending state
raise(Order::PaymentFailedError, self.errors.as_html)
end
end
Expand Down

0 comments on commit 0545862

Please sign in to comment.