diff options
author | Xavier Noria <fxn@hashref.com> | 2010-09-03 21:30:22 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-09-03 21:30:22 +0200 |
commit | 93acbf6bf31ca1802d7631c57da693a824456c4a (patch) | |
tree | 0c2be6d2c127abf50572dc86bf7dc182c00bb49c /activerecord/lib/active_record/locking/pessimistic.rb | |
parent | d28438caf2342be3df8421ed92b95e0510be8ac0 (diff) | |
parent | f8fb4651a7d8218befce48d66f4fadcea6ece37a (diff) | |
download | rails-93acbf6bf31ca1802d7631c57da693a824456c4a.tar.gz rails-93acbf6bf31ca1802d7631c57da693a824456c4a.tar.bz2 rails-93acbf6bf31ca1802d7631c57da693a824456c4a.zip |
Merge remote branch 'docrails/master'
Diffstat (limited to 'activerecord/lib/active_record/locking/pessimistic.rb')
-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 fcc9ebb4af..9ad6a2baf7 100644 --- a/activerecord/lib/active_record/locking/pessimistic.rb +++ b/activerecord/lib/active_record/locking/pessimistic.rb @@ -14,8 +14,8 @@ module ActiveRecord # Example: # Account.transaction do # # select * from accounts where name = 'shugo' limit 1 for update - # shugo = Account.find(:first, :conditions => "name = 'shugo'", :lock => true) - # yuko = Account.find(:first, :conditions => "name = 'yuko'", :lock => true) + # shugo = Account.where("name = 'shugo'").lock(true).first + # yuko = Account.where("name = 'shugo'").lock(true).first # shugo.balance -= 100 # shugo.save! # yuko.balance += 100 @@ -26,7 +26,7 @@ module ActiveRecord # This may be better if you don't need to lock every row. Example: # Account.transaction do # # select * from accounts where ... - # accounts = Account.find(:all, :conditions => ...) + # accounts = Account.where(...).all # account1 = accounts.detect { |account| ... } # account2 = accounts.detect { |account| ... } # # select * from accounts where id=? for update |