diff options
author | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-10-30 16:53:57 -0400 |
---|---|---|
committer | Gannon McGibbon <gannon.mcgibbon@gmail.com> | 2018-10-30 16:58:57 -0400 |
commit | 6e2357f0fe764e15fae280b879c49136b563c2ba (patch) | |
tree | 1e8447a7f9646817929395417bb7c785d4aecfd8 /activerecord | |
parent | b63701e272f3dc932ba7a20127f6dc82b567cfb4 (diff) | |
download | rails-6e2357f0fe764e15fae280b879c49136b563c2ba.tar.gz rails-6e2357f0fe764e15fae280b879c49136b563c2ba.tar.bz2 rails-6e2357f0fe764e15fae280b879c49136b563c2ba.zip |
Fix example for database-specific locking clause
[ci skip]
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/locking/pessimistic.rb | 6 |
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 |