ActiveRecord 是否支持 where 子句中的元组(假设底层数据库支持)?
结果 where 子句看起来像这样:
where (name, address) in (('John', '123 Main St'))
I tried:
Person.where({[:name, :address] => ['John', '123 Main St']})
但它不起作用。
tupleArray = [['John', '123 Main St'],['Jane', '124 Main St']]
Person.where("(name, address) IN (#{(['(?)']*tupleArray.size).join(', ')})", *tupleArray)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)