Posts tagged ActiveRecord
How to ensure multiple ActiveRecord calls happen sequentially
ActiveRecord::Base.transaction do
savings.withdrawal(100)
checking.deposit(100)
end
If any exceptions are raised, the entire operation is rolled back on the database layer and nothing will be committed to the database.