Ruby ActiveRecord and sql tuple support
问题 Does ActiveRecord support tuples in the where clause, assuming the underlying database does? The resulting where clause would look something like: where (name, address) in (('John', '123 Main St')) I tried: Person.where({[:name, :address] => ['John', '123 Main St']}) and it didn't work. 回答1: tupleArray = [['John', '123 Main St'],['Jane', '124 Main St']] Person.where("(name, address) IN (#{(['(?)']*tupleArray.size).join(', ')})", *tupleArray) 回答2: Person.where("(name, address) IN ((?))", [