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