aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/locking
diff options
context:
space:
mode:
authorJoost Baaij <joost@spacebabies.nl>2011-10-25 13:57:24 +0300
committerJoost Baaij <joost@spacebabies.nl>2011-10-25 13:57:24 +0300
commit80bcfb00f71dbacd6af0a76429faa5d104ae3a36 (patch)
tree0a6dbd594233a4a2328e8e9016790c3e88c16b91 /activerecord/lib/active_record/locking
parent7c6d4377b85a4e534f627a8b6ea126d74a7bb039 (diff)
downloadrails-80bcfb00f71dbacd6af0a76429faa5d104ae3a36.tar.gz
rails-80bcfb00f71dbacd6af0a76429faa5d104ae3a36.tar.bz2
rails-80bcfb00f71dbacd6af0a76429faa5d104ae3a36.zip
Added a note that optimistic locking also needs a hidden field to function across web workers.
Diffstat (limited to 'activerecord/lib/active_record/locking')
-rw-r--r--activerecord/lib/active_record/locking/optimistic.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb
index 2df3309648..1a29ded787 100644
--- a/activerecord/lib/active_record/locking/optimistic.rb
+++ b/activerecord/lib/active_record/locking/optimistic.rb
@@ -37,6 +37,9 @@ module ActiveRecord
# You're then responsible for dealing with the conflict by rescuing the exception and either rolling back, merging,
# or otherwise apply the business logic needed to resolve the conflict.
#
+ # This locking mechanism will function inside a single Ruby process. To make it work across all
+ # web requests, the recommended approach is to add +lock_version+ as a hidden field to your form.
+ #
# You must ensure that your database schema defaults the +lock_version+ column to 0.
#
# This behavior can be turned off by setting <tt>ActiveRecord::Base.lock_optimistically = false</tt>.