Skip to content

Commit

Permalink
Correct error in the document for query_constraints [ci-skip]
Browse files Browse the repository at this point in the history
The context of this example suggests what it really wants to
point to is `query_constraints` instead of `query_by`.

Also apply fixed-width font to the reference to the methods correctly.
  • Loading branch information
sato11 committed Feb 1, 2024
1 parent 4332988 commit 3b30137
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions activerecord/lib/active_record/persistence.rb
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def update!(id = :all, attributes)
end

# Accepts a list of attribute names to be used in the WHERE clause
# of SELECT / UPDATE / DELETE queries and in the ORDER BY clause for `#first` and `#last` finder methods.
# of SELECT / UPDATE / DELETE queries and in the ORDER BY clause for +#first+ and +#last+ finder methods.
#
# class Developer < ActiveRecord::Base
# query_constraints :company_id, :id
Expand All @@ -469,7 +469,7 @@ def update!(id = :all, attributes)
# developer.update!(name: "Nikita")
# # UPDATE "developers" SET "name" = 'Nikita' WHERE "developers"."company_id" = 1 AND "developers"."id" = 1
#
# It is possible to update attribute used in the query_by clause:
# # It is possible to update attribute used in the query_constraints clause:
# developer.update!(company_id: 2)
# # UPDATE "developers" SET "company_id" = 2 WHERE "developers"."company_id" = 1 AND "developers"."id" = 1
#
Expand Down

0 comments on commit 3b30137

Please sign in to comment.