aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authordmathieu <42@dmathieu.com>2014-03-07 14:52:44 +0100
committerdmathieu <42@dmathieu.com>2014-03-07 14:52:44 +0100
commit24434880d91ceae15e68fdd90b466ec29627388a (patch)
tree83c9a45498a1c2582ba4b317014dd47a2252ee5c /activerecord
parent589d1ed722a3add255adc5636eab7dcc262dd0ca (diff)
downloadrails-24434880d91ceae15e68fdd90b466ec29627388a.tar.gz
rails-24434880d91ceae15e68fdd90b466ec29627388a.tar.bz2
rails-24434880d91ceae15e68fdd90b466ec29627388a.zip
unscope doesn't remove only the default_scope, but all of them.
[ci-skip] Closes rails/rails#14294
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/scoping/default.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/scoping/default.rb b/activerecord/lib/active_record/scoping/default.rb
index 01fec31544..da01464eb5 100644
--- a/activerecord/lib/active_record/scoping/default.rb
+++ b/activerecord/lib/active_record/scoping/default.rb
@@ -11,7 +11,7 @@ module ActiveRecord
end
module ClassMethods
- # Returns a scope for the model without the +default_scope+.
+ # Returns a scope for the model without the previously set scopes.
#
# class Post < ActiveRecord::Base
# def self.default_scope
@@ -19,11 +19,12 @@ module ActiveRecord
# end
# end
#
- # Post.all # Fires "SELECT * FROM posts WHERE published = true"
- # Post.unscoped.all # Fires "SELECT * FROM posts"
+ # Post.all # Fires "SELECT * FROM posts WHERE published = true"
+ # Post.unscoped.all # Fires "SELECT * FROM posts"
+ # Post.where(published: false).unscoped.app # Fires "SELECT * FROM posts"
#
# This method also accepts a block. All queries inside the block will
- # not use the +default_scope+:
+ # not use the previously set scopes.
#
# Post.unscoped {
# Post.limit(10) # Fires "SELECT * FROM posts LIMIT 10"