我最近安装了这个插件,我打算用它创建一个Tag字段,就像StackOverFlow一样。Auto_complete_for question
当我把下面的语法我AnnouncementsController(我要标记公告)它的伟大工程:
auto_complete_for :announcement, :title
protect_from_forgery :only => [:create, :delete, :update]
此外,我不得不添加路由语法以及使其工作:
map.resources :announcements, :collection => {:auto_complete_for_announcement_title => :get }
现在,当我尝试完成与标签相同的操作时,在创建新通知时,我只需将“标签”和“标题”替换为“标签”一词,即可获得没有工作。标记在数据库中为我的标记表引用。
错误说以下内容:
<h1> ActiveRecord::RecordNotFound
in AnnouncementsController#show </h1>
<pre>Couldn't find Announcement with ID=auto_complete_for_tag_name</pre>
谁能告诉我什么,我做错了什么?
感谢, 布赖恩
我不明白的东西: 什么做text_field_with_auto_complete的参数是指什么?和auto_complete_for方法相同的问题。 因为我试图使它适用于标签,从我的公告视图。 – 2010-01-05 16:21:58
你可以发布你的视图的代码吗? – makevoid 2010-01-05 16:37:46
的作品的一个是: Tags2:<%= text_field_with_auto_complete:公告,:标题,{},{:方法=> :获得}%> 而一个不工作如下: 标签:<%= text_field_with_auto_complete:标记,:名称,{},{:方法=> :get}%> – 2010-01-05 16:40:36