How to get Jquery UI Autocomplete working with Rails 4?

前端 未结 2 1735
感动是毒
感动是毒 2020-12-09 20:08

I\'m using Rails 4.0.2 with jquery-rails (3.1.0) and jquery-ui-rails (4.1.1) gems. I\'m trying to add Autocomplete to the search form (using Bootstrap 3.1.0):



        
2条回答
  •  情书的邮戳
    2020-12-09 20:26

    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]}%")

提交回复
热议问题