diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-12-20 22:18:42 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-12-20 22:18:42 +0530 |
commit | 500ca98fef7a8cc20f1f8f5835091e1f119e0d8a (patch) | |
tree | 8828b963fb2724d12ffbe764218def981e01ddb3 /activerecord/lib/active_record | |
parent | 4fa615a8661eb13d4bd8a7de4d839e9883ef26ec (diff) | |
parent | e52786c361fd3828872089a8e70f690493f331b2 (diff) | |
download | rails-500ca98fef7a8cc20f1f8f5835091e1f119e0d8a.tar.gz rails-500ca98fef7a8cc20f1f8f5835091e1f119e0d8a.tar.bz2 rails-500ca98fef7a8cc20f1f8f5835091e1f119e0d8a.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/scoping/default.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/scoping/default.rb b/activerecord/lib/active_record/scoping/default.rb index 9840cbccae..6b5070808a 100644 --- a/activerecord/lib/active_record/scoping/default.rb +++ b/activerecord/lib/active_record/scoping/default.rb @@ -12,7 +12,7 @@ module ActiveRecord end module ClassMethods - # Returns a scope for this class without taking into account the default_scope. + # Returns a scope for the model without the default_scope. # # class Post < ActiveRecord::Base # def self.default_scope @@ -23,18 +23,20 @@ module ActiveRecord # Post.all # Fires "SELECT * FROM posts WHERE published = true" # Post.unscoped.all # Fires "SELECT * FROM posts" # - # This method also accepts a block meaning that all queries inside the block will + # This method also accepts a block. All queries inside the block will # not use the default_scope: # # Post.unscoped { # Post.limit(10) # Fires "SELECT * FROM posts LIMIT 10" # } # - # It is recommended to use block form of unscoped because chaining unscoped with <tt>scope</tt> - # does not work. Assuming that <tt>published</tt> is a <tt>scope</tt> following two statements are same. + # It is recommended to use the block form of unscoped because chaining + # unscoped with <tt>scope</tt> does not work. Assuming that + # <tt>published</tt> is a <tt>scope</tt>, the following two statements + # are equal: the default_scope is applied on both. # - # Post.unscoped.published - # Post.published + # Post.unscoped.published + # Post.published def unscoped #:nodoc: block_given? ? relation.scoping { yield } : relation end |