aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/query_methods.rb
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-02-01 23:19:38 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-02-01 23:31:43 +0530
commit479f3b4054b7db8c0f9bd325c0e27c918223e02b (patch)
treed9d3e599a8ad48fe16ec7303744f6642bce64727 /activerecord/lib/active_record/relation/query_methods.rb
parent5850ea056054c0610ddc1461dcf71d26ff60fa70 (diff)
downloadrails-479f3b4054b7db8c0f9bd325c0e27c918223e02b.tar.gz
rails-479f3b4054b7db8c0f9bd325c0e27c918223e02b.tar.bz2
rails-479f3b4054b7db8c0f9bd325c0e27c918223e02b.zip
document the AR none method [ci skip]
Diffstat (limited to 'activerecord/lib/active_record/relation/query_methods.rb')
-rw-r--r--activerecord/lib/active_record/relation/query_methods.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb
index 6a28d7b155..b6d762c2e2 100644
--- a/activerecord/lib/active_record/relation/query_methods.rb
+++ b/activerecord/lib/active_record/relation/query_methods.rb
@@ -201,26 +201,26 @@ module ActiveRecord
#
# The returned NullRelation inherits from Relation and implements the
# Null Object pattern so it is an object with defined null behavior:
- # it always returns an empty array of records and avoids any database query.
+ # it always returns an empty array of records and does not query the database.
#
# Any subsequent condition chained to the returned relation will continue
# generating an empty relation and will not fire any query to the database.
#
- # Used in cases where is needed a method or a scope that could return zero
- # results but the response has to be chainable.
+ # This is useful in scenarios where you need a chainable response to a method
+ # or a scope that could return zero results.
#
# For example:
#
# @posts = current_user.visible_posts.where(:name => params[:name])
- # # => the visible_post method response has to be a chainable Relation
+ # # => the visible_posts method is expected to return a chainable Relation
#
# def visible_posts
# case role
- # if 'Country Manager'
+ # when 'Country Manager'
# Post.where(:country => country)
- # if 'Reviewer'
+ # when 'Reviewer'
# Post.published
- # if 'Bad User'
+ # when 'Bad User'
# Post.none # => returning [] instead breaks the previous code
# end
# end