How to get Jquery UI Autocomplete working with Rails 4? How to get Jquery UI Autocomplete working with Rails 4? ruby ruby

How to get Jquery UI Autocomplete working with Rails 4?


  def autocomplete    @products = Product.order(:name).where("name LIKE ?", "%#{params[:term]}%")    respond_to do |format|      format.html      format.json {         render json: @products.map(&:name).to_json      }    end  end


Judging by your note, it looks like you're not fetching the param correctly in your controller, so try:

render json: @products.where("name ILIKE ?", "%#{params[:term]}%")