mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
49295e72d3
commit
7d42317e3d
1 changed files with 8 additions and 14 deletions
|
@ -18,13 +18,13 @@ module ActiveRecord
|
||||||
# See #where for more details on each format.
|
# See #where for more details on each format.
|
||||||
#
|
#
|
||||||
# User.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"])
|
# User.where.not(["name = ?", "Jon"])
|
||||||
# # SELECT * FROM users WHERE name <> 'Jon'
|
# # SELECT * FROM users WHERE NOT (name = 'Jon')
|
||||||
#
|
#
|
||||||
# User.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)
|
# User.where.not(name: nil)
|
||||||
# # SELECT * FROM users WHERE name IS NOT NULL
|
# # 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 })
|
||||||
# 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
|
# If no argument is passed, #where returns a new instance of WhereChain, that
|
||||||
# chained with either #not, #like, or #not_like, returns a new relation.
|
# can be chained with #not to return a new relation that negates the where clause.
|
||||||
#
|
#
|
||||||
# User.where.not(name: "Jon")
|
# User.where.not(name: "Jon")
|
||||||
# # SELECT * FROM users WHERE name <> 'Jon'
|
# # SELECT * FROM users WHERE name != 'Jon'
|
||||||
#
|
#
|
||||||
# Book.where.like(title: "Rails%")
|
# See WhereChain for more details on #not.
|
||||||
# # 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.
|
|
||||||
#
|
#
|
||||||
# === blank condition
|
# === blank condition
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue