Permalink
Browse files

unscope doesn't remove only the default_scope, but all of them.

[ci-skip]
Closes rails/rails#14294
  • Loading branch information...
1 parent 589d1ed commit 24434880d91ceae15e68fdd90b466ec29627388a @dmathieu dmathieu committed Mar 7, 2014
Showing with 5 additions and 4 deletions.
  1. +5 −4 activerecord/lib/active_record/scoping/default.rb
@@ -11,19 +11,20 @@ module Default
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
# where published: true
# 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"

0 comments on commit 2443488

Please sign in to comment.