diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-09-01 12:16:08 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-09-01 12:16:08 -0300 |
commit | 32e296b6ffef68cd4937117819a368e610452370 (patch) | |
tree | 7a95b2b884bf029bd68b402d863cdbaef62db9e2 /activerecord/lib/active_record/locking | |
parent | 37e0c153deea3822ff8ac03675768b966e23efb0 (diff) | |
download | rails-32e296b6ffef68cd4937117819a368e610452370.tar.gz rails-32e296b6ffef68cd4937117819a368e610452370.tar.bz2 rails-32e296b6ffef68cd4937117819a368e610452370.zip |
Use new finders syntax in docs.
Diffstat (limited to 'activerecord/lib/active_record/locking')
-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 |