0
我試圖讓自動完成與rails3-jquery-autocomplete一起工作。我使用mongomapper並具有以下模型有我的Rails應用程序:rails3-jquery-autocomplete和mongomapper給出了NoMethodError undefined方法`table_name`
class Port
include MongoMapper::Document
set_collection_name "ports__status"
key :device, String
在我的控制器
我有
class PortsController < ApplicationController
autocomplete :port, :device
任何我的路線是:
resources :ports do
get :autocomplete_port_device, :on :collection
end
所以,在我看來,我有
<form class="uri_replace" method="get" action="/ports/%device%/">
<input class="inline_replace" name="device" data-autocomplete="/ports/autocomplete_port_device"></input>
<input type="submit">
</form>
(我有在action
重寫提交輸入值爲更寧靜的查詢界面)
所以我加載頁面,我可以看到ajax請求後,我輸入的東西到形式......但是,我得到出現以下錯誤:
NoMethodError in PortsController#autocomplete_port_device
undefined method `table_name' for Port:Class
有什麼建議嗎?