0

我使用 gem https://github.com/crowdint/rails3-jquery-autocomplete的自动完成功能不起作用。当我尝试单独使用自动完成功能(只有一个模型)时,它可以工作。

这是我的控制器:-

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

我也无法正确调试以知道究竟是什么问题。

4

1 回答 1

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"
于 2013-01-18T17:53:34.330 回答