2

I'm using this gem in my rails 4 application for autocompletion. I've followed the example very closely but have had no luck.

First I required these in my application.js is this enough or do I need to go and download jQuery UI? I have jquery-rails gemmed and in my public/javascripts folder have jquery.js jquery.min.js, and jquery_ujs.js files but no jquery.ui files.

//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require autocomplete-rails

Next in my reviews controller (artist has a field called name):

class ReviewsController < ApplicationController

  autocomplete :artist, :name

in routes:

resources :reviews do
    get :autocomplete_artist_name, :on => :collection
end

and in my review form view:

<%= form_for(@review) do |f| %>
<%= f.autocomplete_field :artist, autocomplete_artist_name_reviews_path %>

When I try to type in artist names that already exist in my database, into the artist field of a review, nothing is autocompleted. I cleared browser history first to remove browser autocompletion and there is nothing working with the gem. I've spent a lot of time trying to figure this out and haven't got anywhere. Is it because my review has a field that is named artist as well?

user3509128
  • 142
  • 1
  • 10

1 Answers1

1

As you had stated:

I have jquery-rails gemmed and in my public/javascripts folder have jquery.js jquery.min.js, and jquery_ujs.js files but no jquery.ui files.

According to the jquery-rails github page:

As of v3.0, jquery-rails no longer includes jQuery UI. Use the jquery-ui-rails gem above.

So you can use an older version of jquery-rails or jquery-ui-rails

Please see this question for more info

Community
  • 1
  • 1