mercredi 27 janvier 2016

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

Below query is working in Mysql,but its 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 at or near "{" LINE 2: ...s" = 's_approved')) ORDER BY FIELD(campaigns.id, #{editable_...

Please anyone help me

Aucun commentaire:

Enregistrer un commentaire