Permalink
Browse files

Provide brief introduction to what optimistic locking is. Closes #8097.…

… [fearoffish]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6682 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 06cd7b0 commit 194b4aa4f3feafc1e59b33eb8dc70f793c5921b5 Marcel Molina committed May 6, 2007
Showing with 12 additions and 0 deletions.
  1. +2 −0 activerecord/CHANGELOG
  2. +10 −0 activerecord/lib/active_record/locking/optimistic.rb
View
@@ -1,5 +1,7 @@
*SVN*
+* Provide brief introduction to what optimistic locking is. [fearoffish]
+
* Add documentation for :encoding option to mysql adapter. [marclove]
* Added short-hand declaration style to migrations (inspiration from Sexy Migrations, http://errtheblog.com/post/2381) [DHH]. Example:
@@ -1,5 +1,15 @@
module ActiveRecord
module Locking
+ # == What is Optimistic Locking
+ #
+ # Optimistic locking allows multiple users to access the same record for edits, and assumes a minimum of
+ # conflicts with the data. It does this by checking whether another process has made changes to a record since
+ # it was opened, an ActiveRecord::StaleObjectError is thrown if that has occurred and the update is ignored.
+ #
+ # Check out ActiveRecord::Locking::Pessimistic for an alternative.
+ #
+ # == Usage
+ #
# Active Records support optimistic locking if the field <tt>lock_version</tt> is present. Each update to the
# record increments the lock_version column and the locking facilities ensure that records instantiated twice
# will let the last one saved raise a StaleObjectError if the first was also updated. Example:

0 comments on commit 194b4aa

Please sign in to comment.