Skip to content

Commit ad83a66

Browse files
authored
Merge pull request rails#49116 from gmcgibbon/where_tuple_docs
Document tuple support in Active Record where clauses
2 parents 0f8377d + 6d16512 commit ad83a66

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

activerecord/lib/active_record/relation/query_methods.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,12 @@ def left_outer_joins!(*args) # :nodoc:
883883
# PriceEstimate.where(estimate_of: treasure)
884884
# PriceEstimate.where(estimate_of_type: 'Treasure', estimate_of_id: treasure)
885885
#
886+
# Hash conditions may also be specified in a tuple-like syntax. Hash keys may be
887+
# an array of columns with an array of tuples as values.
888+
#
889+
# Article.where([:author_id, :id] => [[15, 1], [15, 2]])
890+
# # SELECT * FROM articles WHERE author_id = 15 AND id = 1 OR author_id = 15 AND id = 2
891+
#
886892
# === Joins
887893
#
888894
# If the relation is the result of a join, you may create a condition which uses any of the

0 commit comments

Comments
 (0)