From 80bcfb00f71dbacd6af0a76429faa5d104ae3a36 Mon Sep 17 00:00:00 2001 From: Joost Baaij Date: Tue, 25 Oct 2011 13:57:24 +0300 Subject: Added a note that optimistic locking also needs a hidden field to function across web workers. --- activerecord/lib/active_record/locking/optimistic.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/lib') 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 ActiveRecord::Base.lock_optimistically = false. -- cgit v1.2.3