aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/named_scope.rb
diff options
context:
space:
mode:
authorRizwan Reza <rizwanreza@gmail.com>2010-06-16 22:08:14 +0430
committerRizwan Reza <rizwanreza@gmail.com>2010-06-16 22:08:14 +0430
commitd8277804b2ad95275d21492f4d925d1148425253 (patch)
treec2978824a9949e37a6f47597c3315df14022df35 /activerecord/lib/active_record/named_scope.rb
parent317a75bf5860a9ab5d5535ccb4aedfabc83644d6 (diff)
downloadrails-d8277804b2ad95275d21492f4d925d1148425253.tar.gz
rails-d8277804b2ad95275d21492f4d925d1148425253.tar.bz2
rails-d8277804b2ad95275d21492f4d925d1148425253.zip
Adds title and minor changes.
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..096b9da402 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)