Reputation: 407
I'm trying to implement autocomplete feature. I've looked through https://github.com/crowdint/rails3-jquery-autocomplete but I had to missed something because autocomplete field simply doesnt work.
When I'm trying to use autocomplete field nothing happens. Chrome JS console displays following error:
Uncaught TypeError: Object [object Object] has no method 'autocomplete'
class GamesController < ApplicationController
autocomplete :game, :title
get "games/autocomplete_game_title" => "games#autocomplete_game_title", :controller => 'games', :action => "autocomplete_game_title", :via => :get, :as => "autogames"
<% form_for Game.new, :url => { :controller => "games", :action => "edit" } do |f| %>
<%= f.error_messages %>
<%= f.autocomplete_field :title, autogames_path %>
<%= f.submit "Edit" %>
<% end %>
<link href="/stylesheets/admin.css?1300378198" media="screen" rel="stylesheet" type="text/css" />
<script src="/javascripts/jquery.js?1335792905" type="text/javascript"></script>
<script src="/javascripts/jquery_ujs.js?1335792905" type="text/javascript"></script>
<script src="/javascripts/application.js?1335809045" type="text/javascript"></script>
<script src="/javascripts/autocomplete-rails.js?1336304504" type="text/javascript"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/smoothness/jquery-ui.css" media="screen" rel="stylesheet" type="text/css" />
I am completely confused, I've checked almost all combinations. Any suggestions what can be wrong?
Upvotes: 1
Views: 1386
Reputation: 2779
I had similar issues and resolved, then posted some comments to this question. You may want to check out.
Upvotes: 0
Reputation: 263
The problem is that your not loading jquery-ui, you need to add the js and css require if using asset pipeline.
Upvotes: 1