diff options
author | Marcel Molina <marcel@vernix.org> | 2007-05-06 05:01:31 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2007-05-06 05:01:31 +0000 |
commit | 194b4aa4f3feafc1e59b33eb8dc70f793c5921b5 (patch) | |
tree | 45f74bb32501eb520affc47d3cafd7b92231a80b | |
parent | 06cd7b0906c0b6c7c7e60ee329439ae694744134 (diff) | |
download | rails-194b4aa4f3feafc1e59b33eb8dc70f793c5921b5.tar.gz rails-194b4aa4f3feafc1e59b33eb8dc70f793c5921b5.tar.bz2 rails-194b4aa4f3feafc1e59b33eb8dc70f793c5921b5.zip |
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
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index e774c83320..291309ce5d 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -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: diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 7b7f87341e..23e7239d5e 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -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: |