diff options
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/transactions.rb | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 32b767f0a1..59b757eca9 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Explain semantics of having several different AR instances in a transaction block. Closes #9036 [jacobat, Marcel Molina] + * Update Schema documentation to use updated sexy migration notation. Closes #10086 [sjgman9] * Make fixtures work with the new test subclasses. [tarmo, Koz] diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb index 534f179339..205d8c5e24 100644 --- a/activerecord/lib/active_record/transactions.rb +++ b/activerecord/lib/active_record/transactions.rb @@ -41,6 +41,19 @@ module ActiveRecord # transaction.rollback! # rolls back the transaction that was otherwise going to be successful # end # + # == Different ActiveRecord classes in a single transaction + # + # Though the transaction class method is called on some ActiveRecord class, + # the objects within the transaction block need not all be instances of + # that class. + # In this example a <tt>Balance</tt> record is transactionally saved even + # though <tt>transaction</tt> is called on the <tt>Account</tt> class: + # + # Account.transaction do + # balance.save + # account.save + # end + # # == Transactions are not distributed across database connections # # A transaction acts on a single database connection. If you have |