Reputation: 9
Can any one explain me what's my problem :
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 +' ;')
I get this error just for "c.customized_type". What can be the issue?
Upvotes: 0
Views: 2984
Reputation: 699
You are closing the String with ' and semicolon , try this one:
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)
Upvotes: 5