-->

rails3-jquery-autocomplete and writing own search

2019-09-08 05:41发布

问题:

This is my controller, where I use autocomplete gem. I am getting the error for this query:

SELECT  users.id, users.phone, first_name, last_name FROM "users"  WHERE (LOWER(users.phone) ILIKE '77%') ORDER BY users.phone ASC LIMIT 10):

ActiveRecord::StatementInvalid (PGError: ERROR:  function lower(integer) does not exist

My controller:

class CarsController < ApplicationController
  autocomplete :user, :phone

  ...
end

I would like to ask you, how can I do my own db query for autocomplete searching - I need to throw it the error above and I think there is no way to do else...

I got this error, when I deployed my app to Heroku.