任何人都可以解释一下我的问题:
ActiveRecord::Base.connection.select_values('SELECT c.value FROM custom_values c,
time_entries p, custom_fields cf where c.customized_type = 'TimeEntry'
and p.id = c.customized_id and c.custom_field_id = cf.id
and cf.type = 'TimeEntryCustomField' and cf.name = 'Reference TS Client'
and p.id = '+ log.user.id.to_s +' ;')
我只是因为" c.customized_type"而得到此错误。可能是什么问题?
答案 0 :(得分:5)
您正在使用'关闭字符串。和分号,试试这个:
ActiveRecord::Base.connection.select_values("SELECT c.value FROM custom_values c,
time_entries p, custom_fields cf where c.customized_type = 'TimeEntry'
and p.id = c.customized_id and c.custom_field_id = cf.id
and cf.type = 'TimeEntryCustomField' and cf.name = 'Reference TS Client'
and p.id = ?", log.user.id.to_s)