Skip to content

Commit

Permalink
Merge pull request rails#48340 from zzak/ar-query-methods-api-docs
Browse files Browse the repository at this point in the history
Fixes for AR::QueryMethods API docs
  • Loading branch information
zzak authored May 30, 2023
2 parents b899c37 + dd9f3ff commit 96f3c10
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions activerecord/lib/active_record/relation/query_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module ActiveRecord
module QueryMethods
include ActiveModel::ForbiddenAttributesProtection

# WhereChain objects act as placeholder for queries in which +where+ does not have any parameter.
# +WhereChain+ objects act as placeholder for queries in which +where+ does not have any parameter.
# In this case, +where+ can be chained to return a new relation.
class WhereChain
def initialize(scope) # :nodoc:
Expand Down Expand Up @@ -212,7 +212,7 @@ def #{method_name}=(value) # def includes_values=(value)
# # LEFT OUTER JOIN "posts" ON "posts"."user_id" = "users"."id"
# # WHERE "posts"."name" = ? [["name", "example"]]
#
# As the LEFT OUTER JOIN already contains the posts, the second query for
# As the <tt>LEFT OUTER JOIN</tt> already contains the posts, the second query for
# the posts is no longer performed.
#
# Note that #includes works with association names while #references needs
Expand Down Expand Up @@ -320,7 +320,7 @@ def extract_associated(association)
end

# Use to indicate that the given +table_names+ are referenced by an SQL string,
# and should therefore be JOINed in any query rather than loaded separately.
# and should therefore be +JOIN+ed in any query rather than loaded separately.
# This method only works in conjunction with #includes.
# See #includes for more details.
#
Expand Down Expand Up @@ -419,7 +419,7 @@ def _select!(*fields) # :nodoc:
# # )
# # SELECT * FROM posts
#
# Once you define Common Table Expression you can use custom `FROM` value or `JOIN` to reference it.
# Once you define Common Table Expression you can use custom +FROM+ value or +JOIN+ to reference it.
#
# Post.with(posts_with_tags: Post.where("tags_count > ?", 0)).from("posts_with_tags AS posts")
# # => ActiveRecord::Relation
Expand Down Expand Up @@ -647,7 +647,7 @@ def in_order_of(column, values)
#
# User.order('email DESC').reorder('id ASC').order('name ASC')
#
# generates a query with 'ORDER BY id ASC, name ASC'.
# generates a query with <tt>ORDER BY id ASC, name ASC</tt>.
def reorder(*args)
check_if_method_has_arguments!(__callee__, args) do
sanitize_order_arguments(args)
Expand Down Expand Up @@ -797,7 +797,7 @@ def left_outer_joins!(*args) # :nodoc:
# SQL is given as an illustration; the actual query generated may be different depending
# on the database adapter.
#
# === string
# === \String
#
# A single string, without additional arguments, is passed to the query
# constructor as an SQL fragment, and used in the where clause of the query.
Expand All @@ -809,7 +809,7 @@ def left_outer_joins!(*args) # :nodoc:
# to injection attacks if not done properly. As an alternative, it is recommended
# to use one of the following methods.
#
# === array
# === \Array
#
# If an array is passed, then the first element of the array is treated as a template, and
# the remaining elements are inserted into the template to generate the condition.
Expand Down Expand Up @@ -849,7 +849,7 @@ def left_outer_joins!(*args) # :nodoc:
# dependencies on the underlying database. If your code is intended for general consumption,
# test with multiple database backends.
#
# === hash
# === \Hash
#
# #where will also accept a hash condition, in which the keys are fields and the values
# are values to be searched for.
Expand Down Expand Up @@ -895,7 +895,7 @@ def left_outer_joins!(*args) # :nodoc:
# User.joins(:posts).where("posts.published" => true)
# User.joins(:posts).where(posts: { published: true })
#
# === no argument
# === No Argument
#
# If no argument is passed, #where returns a new instance of WhereChain, that
# can be chained with WhereChain#not, WhereChain#missing, or WhereChain#associated.
Expand All @@ -919,7 +919,7 @@ def left_outer_joins!(*args) # :nodoc:
# # LEFT OUTER JOIN "authors" ON "authors"."id" = "posts"."author_id"
# # WHERE "authors"."id" IS NULL
#
# === blank condition
# === Blank Condition
#
# If the condition is any blank-ish object, then #where is a no-op and returns
# the current relation.
Expand Down Expand Up @@ -1315,7 +1315,7 @@ def distinct!(value = true) # :nodoc:
#
# The object returned is a relation, which can be further extended.
#
# === Using a module
# === Using a \Module
#
# module Pagination
# def page(number)
Expand All @@ -1330,7 +1330,7 @@ def distinct!(value = true) # :nodoc:
#
# scope = Model.all.extending(Pagination, SomethingElse)
#
# === Using a block
# === Using a Block
#
# scope = Model.all.extending do
# def page(number)
Expand Down

0 comments on commit 96f3c10

Please sign in to comment.