From 4f59aacb6854885230801a7b694ea592677c3e3d Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Tue, 6 Nov 2007 19:04:54 +0000 Subject: Explain semantics of having several different AR instances in a transaction block. Closes #9036 [jacobat, Marcel Molina] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8096 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/transactions.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'activerecord/lib/active_record/transactions.rb') 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 Balance record is transactionally saved even + # though transaction is called on the Account 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 -- cgit v1.2.3