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.
tupleArray = [['John', '123 Main St'],['Jane', '124 Main St']]
Person.where("(name, address) IN (#{(['(?)']*tupleArray.size).join(', ')})", *tupleArray)
Person.where("(name, address) IN ((?))", ['John', '123 Main St'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With