diff options
author | Xavier Noria <fxn@hashref.com> | 2010-08-25 00:17:02 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-08-25 00:17:02 +0200 |
commit | 036f090df1c1595ef47a8badf7514485f7de06c3 (patch) | |
tree | fe00e7988c2bef6d429e958344a45cc0d760fe19 /activerecord/lib | |
parent | 80e1f730a264a1875e2866cdff4b70b440f36159 (diff) | |
parent | 1a6c81c4f9076885aee593b4aa3704b5cdbeb879 (diff) | |
download | rails-036f090df1c1595ef47a8badf7514485f7de06c3.tar.gz rails-036f090df1c1595ef47a8badf7514485f7de06c3.tar.bz2 rails-036f090df1c1595ef47a8badf7514485f7de06c3.zip |
Merge remote branch 'docrails/master'
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index d53a0c2609..4bbf5cd3d1 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -876,6 +876,11 @@ module ActiveRecord #:nodoc: # limit(10) # Fires "SELECT * FROM posts LIMIT 10" # } # + # It is recommended to use block form of unscoped because chaining unscoped with <tt>named_scope</tt> + # does not work. Assuming that <tt>published</tt> is a <tt>named_scope</tt> following two statements are same. + # + # Post.unscoped.published + # Post.published def unscoped block_given? ? relation.scoping { yield } : relation end diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index c5c40d1863..1ce86da2fa 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -208,10 +208,14 @@ module ActiveRecord # If an attribute name is passed, that attribute is updated along with # updated_at/on attributes. # - # Examples: - # # product.touch # updates updated_at/on # product.touch(:designed_at) # updates the designed_at attribute and updated_at/on + # + # If used along with +belongs_to+ then +touch+ will invoke +touch+ method on associated object. + # + # Brake.belongs_to :car, :touch => true + # Car.belongs_to :corporation, :touch => true + # @brake.touch #=> will also invoke @brake.car.touch and @brake.car.corporation.touch def touch(name = nil) attributes = timestamp_attributes_for_update_in_model unless attributes.blank? |