Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…ction across web workers.
  • Loading branch information...
commit 80bcfb00f71dbacd6af0a76429faa5d104ae3a36 1 parent 7c6d437
@tilsammans tilsammans authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  activerecord/lib/active_record/locking/optimistic.rb
View
3  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>.
Please sign in to comment.
Something went wrong with that request. Please try again.