mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Wrap updates in a transaction block
Ensures the operation will be rolled ack if either saving the new record or deleting the old record fail
This commit is contained in:
@@ -20,7 +20,9 @@ class TaxRateUpdater
|
||||
end
|
||||
|
||||
def transition_rate!
|
||||
updated_rate.save && current_rate.destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
updated_rate.save && current_rate.destroy
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user