Transactions with ActiveRecord : Transactions « ActiveRecord « Ruby






Transactions with ActiveRecord



my_account = Account.find 3
your_account = Account.find 4

Account.transaction do
  my_account.update_attribute(:balance, my_account.balance-300.00)
  your_account.update_attribute(:balance, your_account.balance+300.00)
end

 








Related examples in the same category