diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-08-23 05:45:11 -0400 |
---|---|---|
committer | Neeraj Singh <neerajdotname@gmail.com> | 2010-08-23 05:45:11 -0400 |
commit | 13ebf69ae4a47f2d1d2b1eebd1e84df2098e3a57 (patch) | |
tree | 85e9ed196a319f958620e5ff0937405fae3a6b13 /activerecord | |
parent | b587bfd589cbb4469b9e49bfdd90f033d14adc9a (diff) | |
download | rails-13ebf69ae4a47f2d1d2b1eebd1e84df2098e3a57.tar.gz rails-13ebf69ae4a47f2d1d2b1eebd1e84df2098e3a57.tar.bz2 rails-13ebf69ae4a47f2d1d2b1eebd1e84df2098e3a57.zip |
unscoped does not work when chained with named_scope
Diffstat (limited to 'activerecord')
-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 |