Browse files

Added a note that optimistic locking also needs a hidden field to fun…

…ction across web workers.
  • Loading branch information...
1 parent 7c6d437 commit 80bcfb00f71dbacd6af0a76429faa5d104ae3a36 @tilsammans tilsammans committed Oct 25, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 activerecord/lib/active_record/locking/optimistic.rb
@@ -37,6 +37,9 @@ module Locking
# 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>.

0 comments on commit 80bcfb0

Please sign in to comment.