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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -