diff options
author | Rolf Timmermans <r.timmermans@voormedia.com> | 2011-03-27 17:18:32 +0200 |
---|---|---|
committer | Rolf Timmermans <r.timmermans@voormedia.com> | 2011-03-27 17:18:32 +0200 |
commit | 512057d386075f207d8927a5e0ce3943174d5c78 (patch) | |
tree | c0b9122469af1e4af74142cc2cad6d560226753c /activerecord/lib/active_record/locking | |
parent | d89a7967b5af5c87bbfc268af72287b82541d384 (diff) | |
parent | a9d27c04abf24dc85be061ff9772d71897af02b1 (diff) | |
download | rails-512057d386075f207d8927a5e0ce3943174d5c78.tar.gz rails-512057d386075f207d8927a5e0ce3943174d5c78.tar.bz2 rails-512057d386075f207d8927a5e0ce3943174d5c78.zip |
Merge remote-tracking branch 'upstream/master' into desc_tracker
Diffstat (limited to 'activerecord/lib/active_record/locking')
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/locking/pessimistic.rb | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 6b2b1ebafe..9a31675782 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -23,7 +23,7 @@ module ActiveRecord # p2.first_name = "should fail" # p2.save # Raises a ActiveRecord::StaleObjectError # - # Optimistic locking will also check for stale data when objects are destroyed. Example: + # Optimistic locking will also check for stale data when objects are destroyed. Example: # # p1 = Person.find(1) # p2 = Person.find(1) 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? |