【发布时间】:2015-05-04 13:25:37
【问题描述】:
我尝试使用 where 条件和包含的值来查找数组。 但是遇到一些错误..
以下效果很好,并返回受益人,包括用户
Beneficiary.includes(:user).where("beneficiaries.id = ?",304)
但是当我尝试使用 ID 数组时,我遇到了一些错误
Beneficiary.includes(:caterer_info).where("beneficiaries.id = ?",[304,305])
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '304,305)'
【问题讨论】:
标签: ruby-on-rails ruby arrays ruby-on-rails-4 orm