aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/locking/pessimistic.rb
diff options
context:
space:
mode:
authorJohn Mileham <jmileham@gmail.com>2011-03-24 15:03:08 -0400
committerJohn Mileham <jmileham@gmail.com>2011-03-24 15:03:08 -0400
commitb44a0ec153c84384e9b97a069e81f28bc5c2a4bf (patch)
tree94713aff0c241f91530dfd714bf685019c84ccab /activerecord/lib/active_record/locking/pessimistic.rb
parentd5994ee48af14d67f0eec7d23863d4b19211b078 (diff)
parent5214e73850916de3c9127d35a4ecee0424d364a3 (diff)
downloadrails-b44a0ec153c84384e9b97a069e81f28bc5c2a4bf.tar.gz
rails-b44a0ec153c84384e9b97a069e81f28bc5c2a4bf.tar.bz2
rails-b44a0ec153c84384e9b97a069e81f28bc5c2a4bf.zip
Merge branch 'master' of github.com:rails/rails into count_behavior
Diffstat (limited to 'activerecord/lib/active_record/locking/pessimistic.rb')
-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 557b277d6b..862cf8f72a 100644
--- a/activerecord/lib/active_record/locking/pessimistic.rb
+++ b/activerecord/lib/active_record/locking/pessimistic.rb
@@ -9,9 +9,8 @@ module ActiveRecord
# Account.find(1, :lock => true)
#
# Pass <tt>:lock => 'some locking clause'</tt> to give a database-specific locking clause
- # of your own such as 'LOCK IN SHARE MODE' or 'FOR UPDATE NOWAIT'.
+ # of your own such as 'LOCK IN SHARE MODE' or 'FOR UPDATE NOWAIT'. Example:
#
- # Example:
# Account.transaction do
# # select * from accounts where name = 'shugo' limit 1 for update
# shugo = Account.where("name = 'shugo'").lock(true).first
@@ -24,6 +23,7 @@ module ActiveRecord
#
# You can also use ActiveRecord::Base#lock! method to lock one record by id.
# This may be better if you don't need to lock every row. Example:
+ #
# Account.transaction do
# # select * from accounts where ...
# accounts = Account.where(...).all
@@ -44,7 +44,7 @@ module ActiveRecord
module Pessimistic
# Obtain a row lock on this record. Reloads the record to obtain the requested
# lock. Pass an SQL locking clause to append the end of the SELECT statement
- # or pass true for "FOR UPDATE" (the default, an exclusive row lock). Returns
+ # or pass true for "FOR UPDATE" (the default, an exclusive row lock). Returns
# the locked record.
def lock!(lock = true)
reload(:lock => lock) if persisted?