aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2010-08-25 00:17:02 +0200
committerXavier Noria <fxn@hashref.com>2010-08-25 00:17:02 +0200
commit036f090df1c1595ef47a8badf7514485f7de06c3 (patch)
treefe00e7988c2bef6d429e958344a45cc0d760fe19 /activerecord/lib/active_record/base.rb
parent80e1f730a264a1875e2866cdff4b70b440f36159 (diff)
parent1a6c81c4f9076885aee593b4aa3704b5cdbeb879 (diff)
downloadrails-036f090df1c1595ef47a8badf7514485f7de06c3.tar.gz
rails-036f090df1c1595ef47a8badf7514485f7de06c3.tar.bz2
rails-036f090df1c1595ef47a8badf7514485f7de06c3.zip
Merge remote branch 'docrails/master'
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r--activerecord/lib/active_record/base.rb5
1 files changed, 5 insertions, 0 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