aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-10-30 17:14:05 -0400
committerGitHub <noreply@github.com>2018-10-30 17:14:05 -0400
commit6b23b7e78c60ecdff78170d1607350a4fafdb4db (patch)
tree2d545e4f210147933c6ebc598d552e7e2d3193c8 /activerecord/lib
parentf4876545ffc8712fe5c62de2fff2822c7f9dad52 (diff)
parent6e2357f0fe764e15fae280b879c49136b563c2ba (diff)
downloadrails-6b23b7e78c60ecdff78170d1607350a4fafdb4db.tar.gz
rails-6b23b7e78c60ecdff78170d1607350a4fafdb4db.tar.bz2
rails-6b23b7e78c60ecdff78170d1607350a4fafdb4db.zip
Merge pull request #34353 from gmcgibbon/fix_lock_docs_locking_clause
Fix example for database-specific locking clause
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/locking/pessimistic.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/locking/pessimistic.rb b/activerecord/lib/active_record/locking/pessimistic.rb
index 5d1d15c94d..130ef8a330 100644
--- a/activerecord/lib/active_record/locking/pessimistic.rb
+++ b/activerecord/lib/active_record/locking/pessimistic.rb
@@ -14,9 +14,9 @@ module ActiveRecord
# of your own such as 'LOCK IN SHARE MODE' or 'FOR UPDATE NOWAIT'. Example:
#
# Account.transaction do
- # # select * from accounts where name = 'shugo' limit 1 for update
- # shugo = Account.where("name = 'shugo'").lock(true).first
- # yuko = Account.where("name = 'yuko'").lock(true).first
+ # # select * from accounts where name = 'shugo' limit 1 for update nowait
+ # shugo = Account.lock("FOR UPDATE NOWAIT").find_by(name: "shugo")
+ # yuko = Account.lock("FOR UPDATE NOWAIT").find_by(name: "yuko")
# shugo.balance -= 100
# shugo.save!
# yuko.balance += 100