diff options
-rw-r--r-- | activerecord/lib/active_record/base.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 3be302a5fd..bbb44f0e17 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 |