ruby on rails - PGError: ERROR: syntax error at or near E'String' -
i have ruby on rails condition works in mysql not in postgres
:conditions => ["a between ? , ? , b between ? , ? , c between ? , ? , ddd ?",@amin,@amax,@bmin,@bmax,@cmin,@cmax,params[:input].to_s]
generates error:
activerecord::statementinvalid (pgerror: error: syntax error @ or near "e'word'" line 1: ...c between -100 , 100 , ddd e'word')
i know works without last comparison. eg.
:conditions => ["a between ? , ? , b between ? , ? , c between ? , ?",@amin,@amax,@bmin,@bmax,@cmin,@cmax]
ddd of type :string whereas a,b , c :decimal.
after doing research on postgresql seems e' strings escaped strings - doesn't me can't seem correct it. don't work postgresql apologize in advance if obvious.
i'm using heroku hosting can't change postgresql settings. anyway, i'd prefer understand problem , how fix it.
cheers, stu
try changing
ddd ?
into
ddd = ?
Comments
Post a Comment