Skip to content

Commit 7d42317

Browse files
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.
1 parent 49295e7 commit 7d42317

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

activerecord/lib/active_record/relation/query_methods.rb

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ def initialize(scope)
1818
# See #where for more details on each format.
1919
#
2020
# User.where.not("name = 'Jon'")
21-
# # SELECT * FROM users WHERE name <> 'Jon'
21+
# # SELECT * FROM users WHERE NOT (name = 'Jon')
2222
#
2323
# User.where.not(["name = ?", "Jon"])
24-
# # SELECT * FROM users WHERE name <> 'Jon'
24+
# # SELECT * FROM users WHERE NOT (name = 'Jon')
2525
#
2626
# User.where.not(name: "Jon")
27-
# # SELECT * FROM users WHERE name <> 'Jon'
27+
# # SELECT * FROM users WHERE name != 'Jon'
2828
#
2929
# User.where.not(name: nil)
3030
# # SELECT * FROM users WHERE name IS NOT NULL
@@ -415,21 +415,15 @@ def bind!(value) # :nodoc:
415415
# User.joins(:posts).where({ "posts.published" => true })
416416
# User.joins(:posts).where({ posts: { published: true } })
417417
#
418-
# === no argument or :chain
418+
# === no argument
419419
#
420-
# If no argument or :chain is passed, #where returns a new instance of WhereChain which, when
421-
# chained with either #not, #like, or #not_like, returns a new relation.
420+
# If no argument is passed, #where returns a new instance of WhereChain, that
421+
# can be chained with #not to return a new relation that negates the where clause.
422422
#
423423
# User.where.not(name: "Jon")
424-
# # SELECT * FROM users WHERE name <> 'Jon'
424+
# # SELECT * FROM users WHERE name != 'Jon'
425425
#
426-
# Book.where.like(title: "Rails%")
427-
# # SELECT * FROM books WHERE title LIKE 'Rails%'
428-
#
429-
# Conference.where.not_like(name: "%Kaigi")
430-
# # SELECT * FROM conferences WHERE name NOT LIKE '%Kaigi'
431-
#
432-
# See WhereChain for more details on #not, #like, and #not_like.
426+
# See WhereChain for more details on #not.
433427
#
434428
# === blank condition
435429
#

0 commit comments

Comments
 (0)