2012-09-22 43 views
0

我的自動完成功能使用gem https://github.com/crowdint/rails3-jquery-autocomplete不起作用。當我試圖與孤立(只有一個模型)的自動完成工作。rails-3-jquery自動完成功能不能與嵌套模型一起使用

這裏是我的控制器: -

autocomplete :location, :name 

型號: -

belongs_to :location 

查看: -

= fields_for @event.location do |location| 

    = location.autocomplete_field :name, autocomplete_location_name_events_path, :placeholder => "Enter the name of the location" 

路線: -

resources :events do 
    get :autocomplete_location_name, :on => :collection 
end 

application.js.cofee

#= require autocomplete-rails 

我不能調試正確無論是作爲知道究竟是什麼的問題。

+0

我有同樣的問題。你找到解決方案嗎? – Jayaram

回答

1

嘗試

路線:

get 'events/autocomplete_location_name' 

查看:

fields_for :location do |location| 
location.autocomplete_field :name, events_autocomplete_location_name, :placeholder => "Enter the name of the location"