Я пытаюсь заставить автозаполнение работать под Rails 3.1.
https://github.com/crowdint/rails3-jquery-autocomplete
Я следовал этому полному примеру приложения и изменял соответствующие части для Rails 3.1, но он все еще не работает.
https://github.com/crowdint/rails3-jquery-autocomplete-app
Вот мой файл applicationaion.js
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require autocomplete-rails
//= require_tree .
Я скачал jquery 1.8.16 (с пометкой «автозаполнение»), разархивировал его и скопировал js в каталог app / assets / javascript, а каталог css & images в app / assets / stylesheets.
Затем я сделал ссылку, чтобы я мог ссылаться на нее как jquery-ui
ln -s jquery-ui-1.8.16.custom.min.js jquery-ui.js
То же самое с CSS
ln -s jquery-ui-1.8.16.custom.css jquery-ui.css
Затем я помещаю ссылку на мой CSS в application.css
*= require_self
*= require jquery-ui
*= require_tree .
Я создал модель бренда, перенес и добавил данные о семенах, как в примере.
Затем я добавил в свой приветственный контроллер следующую строку в соответствии с руководством:
autocomplete :brand, :name
Я исправил файл rout.rb и отредактировал форму.
То, что я получаю, это форма без работающего автозаполнения, в выводе моего сервера также нет ошибок:
% rails s -p 3001
=> Booting WEBrick
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3001
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-11-07 16:35:53] INFO WEBrick 1.3.1
[2011-11-07 16:35:53] INFO ruby 1.9.2 (2011-02-18) [x86_64-linux]
[2011-11-07 16:35:53] INFO WEBrick::HTTPServer#start: pid=12616 port=3001
Started GET "/" for 127.0.0.1 at 2011-11-07 16:35:54 +1100
Processing by WelcomeController#show as HTML
Rendered welcome/show.html.erb within layouts/application (15.7ms)
Completed 200 OK in 98ms (Views: 75.6ms | ActiveRecord: 0.0ms)
Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /application.css - 304 Not Modified (0ms)
Started GET "/assets/jquery-ui.css?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /jquery-ui.css - 304 Not Modified (5ms)
Started GET "/assets/jquery-ui-1.8.16.custom.css?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /jquery-ui-1.8.16.custom.css - 304 Not Modified (1ms)
Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /jquery.js - 304 Not Modified (1ms)
Started GET "/assets/welcome.css?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /welcome.css - 304 Not Modified (2ms)
Started GET "/assets/jquery-ui.js?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /jquery-ui.js - 304 Not Modified (5ms)
Started GET "/assets/jquery-ui-1.8.16.custom.min.js?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /jquery-ui-1.8.16.custom.min.js - 304 Not Modified (3ms)
Started GET "/assets/welcome.js?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /welcome.js - 304 Not Modified (2ms)
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /application.js - 304 Not Modified (0ms)
Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /jquery_ujs.js - 304 Not Modified (1ms)
Started GET "/assets/autocomplete-rails.js?body=1" for 127.0.0.1 at 2011-11-07 16:35:55 +1100
Served asset /autocomplete-rails.js - 304 Not Modified (1ms)
Что мне здесь не хватает?
Есть ли более современный плагин для Rails 3.1 или лучший учебник?