aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/transactions.rb
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2007-11-29 22:25:42 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2007-11-29 22:25:42 +0000
commita25b2e116caa0378807f5681355c63f6aa219190 (patch)
treef8db3cf457267d8268944c44f8328df444f50066 /activerecord/lib/active_record/transactions.rb
parent1d32cec17d768ac78d52903f5ed8b19cc37c7f78 (diff)
downloadrails-a25b2e116caa0378807f5681355c63f6aa219190.tar.gz
rails-a25b2e116caa0378807f5681355c63f6aa219190.tar.bz2
rails-a25b2e116caa0378807f5681355c63f6aa219190.zip
Removed documentation for the removed rollback! method on transactions and mention ActiveRecord::Rollback [cody]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8240 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/transactions.rb')
-rw-r--r--activerecord/lib/active_record/transactions.rb14
1 files changed, 2 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb
index 61f5d819fc..45a6418492 100644
--- a/activerecord/lib/active_record/transactions.rb
+++ b/activerecord/lib/active_record/transactions.rb
@@ -30,17 +30,6 @@ module ActiveRecord
# Exceptions will force a ROLLBACK that returns the database to the state before the transaction was begun. Be aware, though,
# that the objects by default will _not_ have their instance data returned to their pre-transactional state.
#
- # == Rolling back a transaction manually
- #
- # Instead of relying on exceptions to rollback your transactions, you can also do so manually from within the scope
- # of the transaction by accepting a yield parameter and calling rollback! on it. Example:
- #
- # transaction do |transaction|
- # david.withdrawal(100)
- # mary.deposit(100)
- # 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,
@@ -80,7 +69,8 @@ module ActiveRecord
# == Exception handling
#
# Also have in mind that exceptions thrown within a transaction block will be propagated (after triggering the ROLLBACK), so you
- # should be ready to catch those in your application code.
+ # should be ready to catch those in your application code. One exception is the ActiveRecord::Rollback exception, which will
+ # trigger a ROLLBACK when raised, but not be re-raised by the transaction block.
module ClassMethods
def transaction(&block)
previous_handler = trap('TERM') { raise TransactionError, "Transaction aborted" }