aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/named_scope.rb
diff options
context:
space:
mode:
authorBryan Woods <bryanwoods4e@gmail.com>2010-06-16 15:53:20 -0400
committerBryan Woods <bryanwoods4e@gmail.com>2010-06-16 15:53:20 -0400
commit5861fde01fbe9446666b319dfc8d24514aafda21 (patch)
tree4c78ceda7ec49a54b1c2454217e85d36d1a937aa /activerecord/lib/active_record/named_scope.rb
parentc1ff781001af157c0d5ea5ac64e1fa17d47fe1f1 (diff)
parent35e3f72af29a33189a46a4b5ada84768b87e0ef2 (diff)
downloadrails-5861fde01fbe9446666b319dfc8d24514aafda21.tar.gz
rails-5861fde01fbe9446666b319dfc8d24514aafda21.tar.bz2
rails-5861fde01fbe9446666b319dfc8d24514aafda21.zip
Merge remote branch 'origin/master'
Diffstat (limited to 'activerecord/lib/active_record/named_scope.rb')
-rw-r--r--activerecord/lib/active_record/named_scope.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index 3d8f4a030b..47eef9535e 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -4,11 +4,12 @@ require 'active_support/core_ext/kernel/singleton_class'
require 'active_support/core_ext/object/blank'
module ActiveRecord
+ # = Active Record Named Scopes
module NamedScope
extend ActiveSupport::Concern
module ClassMethods
- # Returns an anonymous scope.
+ # Returns an anonymous \scope.
#
# posts = Post.scoped
# posts.size # Fires "select count(*) from posts" and returns the count
@@ -18,10 +19,12 @@ module ActiveRecord
# fruits = fruits.where(:colour => 'red') if options[:red_only]
# fruits = fruits.limit(10) if limited?
#
- # Anonymous \scopes tend to be useful when procedurally generating complex queries, where passing
- # intermediate values (scopes) around as first-class objects is convenient.
+ # Anonymous \scopes tend to be useful when procedurally generating complex
+ # queries, where passing intermediate values (scopes) around as first-class
+ # objects is convenient.
#
- # You can define a scope that applies to all finders using ActiveRecord::Base.default_scope.
+ # You can define a scope that applies to all finders using
+ # ActiveRecord::Base.default_scope.
def scoped(options = {}, &block)
if options.present?
relation = scoped.apply_finder_options(options)