Permalink
Browse files

Explain semantics of having several different AR instances in a trans…

…action block. Closes #9036 [jacobat, Marcel Molina]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8096 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 341afb6 commit 4f59aacb6854885230801a7b694ea592677c3e3d Marcel Molina committed Nov 6, 2007
Showing with 15 additions and 0 deletions.
  1. +2 −0 activerecord/CHANGELOG
  2. +13 −0 activerecord/lib/active_record/transactions.rb
@@ -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]
@@ -41,6 +41,19 @@ def self.included(base)
# 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

0 comments on commit 4f59aac

Please sign in to comment.