Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11052: Transaction-documentation-update.diff

File Transaction-documentation-update.diff, 1.6 kB (added by Startrader, 5 months ago)
  • activerecord/lib/active_record/transactions.rb

    old new  
    2828    # 
    2929    # This example will only take money from David and give to Mary if neither +withdrawal+ nor +deposit+ raises an exception. 
    3030    # Exceptions will force a ROLLBACK that returns the database to the state before the transaction was begun. Be aware, though, 
    31     # that the objects by default will _not_ have their instance data returned to their pre-transactional state. 
     31    # that the objects will _not_ have their instance data returned to their pre-transactional state. 
    3232    # 
    3333    # == Different ActiveRecord classes in a single transaction 
    3434    # 
  • activerecord/README

    old new  
    102102  {Learn more}[link:classes/ActiveRecord/Base.html] 
    103103 
    104104 
    105 * Transaction support on both a database and object level. The latter is implemented  
    106   by using Transaction::Simple[http://railsmanual.com/module/Transaction::Simple] 
     105* Transactions   
    107106 
    108107    # Just database transaction 
    109108    Account.transaction do 
     
    111110      mary.deposit(100) 
    112111    end 
    113112 
    114     # Database and object transaction 
    115     Account.transaction(david, mary) do 
    116       david.withdrawal(100) 
    117       mary.deposit(100) 
    118     end 
    119  
    120113  {Learn more}[link:classes/ActiveRecord/Transactions/ClassMethods.html] 
    121114 
    122115