Skip to content
This repository
Browse code

Removed documentation for the removed rollback! method on transaction…

…s and mention ActiveRecord::Rollback [cody]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8240 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit a25b2e116caa0378807f5681355c63f6aa219190 1 parent 1d32cec
authored November 29, 2007
14  activerecord/lib/active_record/transactions.rb
@@ -30,17 +30,6 @@ def self.included(base)
30 30
     # Exceptions will force a ROLLBACK that returns the database to the state before the transaction was begun. Be aware, though,
31 31
     # that the objects by default will _not_ have their instance data returned to their pre-transactional state.
32 32
     #
33  
-    # == Rolling back a transaction manually
34  
-    #
35  
-    # Instead of relying on exceptions to rollback your transactions, you can also do so manually from within the scope
36  
-    # of the transaction by accepting a yield parameter and calling rollback! on it. Example:
37  
-    #
38  
-    #   transaction do |transaction|
39  
-    #     david.withdrawal(100)
40  
-    #     mary.deposit(100)
41  
-    #     transaction.rollback! # rolls back the transaction that was otherwise going to be successful
42  
-    #   end
43  
-    #
44 33
     # == Different ActiveRecord classes in a single transaction
45 34
     #
46 35
     # Though the transaction class method is called on some ActiveRecord class,
@@ -80,7 +69,8 @@ def self.included(base)
80 69
     # == Exception handling
81 70
     #
82 71
     # Also have in mind that exceptions thrown within a transaction block will be propagated (after triggering the ROLLBACK), so you
83  
-    # should be ready to catch those in your application code.
  72
+    # should be ready to catch those in your application code. One exception is the ActiveRecord::Rollback exception, which will
  73
+    # trigger a ROLLBACK when raised, but not be re-raised by the transaction block.
84 74
     module ClassMethods
85 75
       def transaction(&block)
86 76
         previous_handler = trap('TERM') { raise TransactionError, "Transaction aborted" }

0 notes on commit a25b2e1

Please sign in to comment.
Something went wrong with that request. Please try again.