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

Changeset 6682

Show
Ignore:
Timestamp:
05/06/07 05:01:31 (2 years ago)
Author:
marcel
Message:

Provide brief introduction to what optimistic locking is. Closes #8097. [fearoffish]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r6678 r6682  
    11*SVN* 
     2 
     3* Provide brief introduction to what optimistic locking is. [fearoffish] 
    24 
    35* Add documentation for :encoding option to mysql adapter. [marclove] 
  • trunk/activerecord/lib/active_record/locking/optimistic.rb

    r6396 r6682  
    11module ActiveRecord 
    22  module Locking 
     3    # == What is Optimistic Locking 
     4    # 
     5    # Optimistic locking allows multiple users to access the same record for edits, and assumes a minimum of  
     6    # conflicts with the data.  It does this by checking whether another process has made changes to a record since 
     7    # it was opened, an ActiveRecord::StaleObjectError is thrown if that has occurred and the update is ignored. 
     8    # 
     9    # Check out ActiveRecord::Locking::Pessimistic for an alternative. 
     10    # 
     11    # == Usage 
     12    # 
    313    # Active Records support optimistic locking if the field <tt>lock_version</tt> is present.  Each update to the 
    414    # record increments the lock_version column and the locking facilities ensure that records instantiated twice