我試圖找到使用條件和包括的值的數組。 但流汗一些錯誤..導軌包含ID條件的數組
下面運作良好,並與用戶返回受益人包括
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)'
可能有助於http://stackoverflow.com/questions/5947593/how-to-use-in-1-2- 3與 - 的findall –