Rails 使用数据库事务 (ActiveRecord) 2015/07/05 15250 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