From 7d42317e3dad0a9045dbe1fc64270e03433b1d7c Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 8 Dec 2012 14:21:06 -0200 Subject: [PATCH] Improve where.not docs [ci skip] * Fix example queries * Remove doc entries of where.like/not_like. * Remove :chain from where.not related docs. To me that's an implementation detail and we don't expect people to use where(:chain).not. --- .../active_record/relation/query_methods.rb | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index f6d106f304..46c0d6206f 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -18,13 +18,13 @@ module ActiveRecord # See #where for more details on each format. # # User.where.not("name = 'Jon'") - # # SELECT * FROM users WHERE name <> 'Jon' + # # SELECT * FROM users WHERE NOT (name = 'Jon') # # User.where.not(["name = ?", "Jon"]) - # # SELECT * FROM users WHERE name <> 'Jon' + # # SELECT * FROM users WHERE NOT (name = 'Jon') # # User.where.not(name: "Jon") - # # SELECT * FROM users WHERE name <> 'Jon' + # # SELECT * FROM users WHERE name != 'Jon' # # User.where.not(name: nil) # # SELECT * FROM users WHERE name IS NOT NULL @@ -415,21 +415,15 @@ module ActiveRecord # User.joins(:posts).where({ "posts.published" => true }) # User.joins(:posts).where({ posts: { published: true } }) # - # === no argument or :chain + # === no argument # - # If no argument or :chain is passed, #where returns a new instance of WhereChain which, when - # chained with either #not, #like, or #not_like, returns a new relation. + # If no argument is passed, #where returns a new instance of WhereChain, that + # can be chained with #not to return a new relation that negates the where clause. # # User.where.not(name: "Jon") - # # SELECT * FROM users WHERE name <> 'Jon' + # # SELECT * FROM users WHERE name != 'Jon' # - # Book.where.like(title: "Rails%") - # # SELECT * FROM books WHERE title LIKE 'Rails%' - # - # Conference.where.not_like(name: "%Kaigi") - # # SELECT * FROM conferences WHERE name NOT LIKE '%Kaigi' - # - # See WhereChain for more details on #not, #like, and #not_like. + # See WhereChain for more details on #not. # # === blank condition #