未验证 提交 6b23b7e7 编写于 作者: R Rafael França 提交者: GitHub

Merge pull request #34353 from gmcgibbon/fix_lock_docs_locking_clause

Fix example for database-specific locking clause
......@@ -14,9 +14,9 @@ module Locking
# 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册