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 -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -