嗨,我正在使用 rails 和活动记录,我的活动记录查询存在一些问题。
session[:profile_ids] = [2,4,5]
@profiles = UserProfile.where("key = ? and id in (?)", 'Noc_Address',
session[:profile_ids])
但我收到此错误:
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
'key = 'Noc_Address')' at line 1: SELECT `user_profiles`.* FROM
`user_profiles` WHERE (id in (361) and key = 'Noc_Address')
我怎样才能纠正它?
谢谢。