ruby - syntax error at or near "{" using rails in postgresql -


below query working in mysql,but not working in postgresql.

campaign.scheduled_with_community_ids(community_ids).         joins(:community).         order('field(campaigns.id, #{editable_ids}) desc').         order(:launch_date, 'communities.community_name') 

am getting below error

activerecord::statementinvalid - pg::syntaxerror: error:  syntax error @ or near "{" line 2: ...s" = 's_approved')) order field(campaigns.id, #{editable_... 

please me

you should use double-quoted strings when want use interpolation:

campaign.scheduled_with_community_ids(community_ids).     joins(:community).     order("field(campaigns.id, #{editable_ids}) desc").     order(:launch_date, 'communities.community_name') 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -