aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/named_scope.rb
diff options
context:
space:
mode:
authorRyan Bigg <radarlistener@gmail.com>2011-03-31 06:47:01 +1100
committerRyan Bigg <radarlistener@gmail.com>2011-03-31 06:48:05 +1100
commit04d5decfd3c8f899df462bfc7f1ccb9770542a97 (patch)
tree9589e34004775121e4bf30326af71e7966bf0df4 /activerecord/lib/active_record/named_scope.rb
parent7a34ab7d60756856b79d2f8ef33ac843a78b70ad (diff)
downloadrails-04d5decfd3c8f899df462bfc7f1ccb9770542a97.tar.gz
rails-04d5decfd3c8f899df462bfc7f1ccb9770542a97.tar.bz2
rails-04d5decfd3c8f899df462bfc7f1ccb9770542a97.zip
Cleanup of named_scope documentation
Diffstat (limited to 'activerecord/lib/active_record/named_scope.rb')
-rw-r--r--activerecord/lib/active_record/named_scope.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index 603a0c169a..8eb87f7b7a 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -101,24 +101,25 @@ module ActiveRecord
# Article.published.create.published # => true
#
# Class methods on your model are automatically available
- # on scopes
- #
+ # on scopes. Assuming the following setup:
+ #
# class Article < ActiveRecord::Base
# scope :published, where(:published => true)
# scope :featured, where(:featured => true)
- #
+ #
# def self.latest_article
- # order('published_at desc').first
+ # order('published_at desc').first
# end
- #
+ #
# def self.titles
# map {|article| article.title}
# end
#
# end
- #
- # Example usage:
- # Article.published.featured.latest_article
+ #
+ # We are able to call the methods like this:
+ #
+ # Article.published.featured.latest_article
# Article.featured.titles
def scope(name, scope_options = {})