I m 采用“As_Taggable_ On。
在每个项目中增加标记(如我的情况类型/类型)是巨大的。 在Im st脚石的地方,如何利用法律消除个人标签——As_Taggable_ 关于我想要能够点击每个标的旁边的X文本链接(见链接),以便把标子从这些项目的类型中删除。
我搜索了这些文件,并找到了一条大致如下的方法:
project.type_list.remove("your tag")
但我需要帮助的是,如何将清除方法称作具体主角,特别是因为所有东西都正在与......做ach。
My controller and model code is pretty minimal and standard - based on Act_As_Taggable_On docs. Here is my view code for generating the layout above:
<h1><%= @title %></h1>
<div class="column-left">
<% @projects.each do |project| %>
<div class="p_wrapper">
<table>
<tr>
<td><div class="project p_name"><%= project.name %></div></td>
<td><div class="p_link"><%= link_to Edit , edit_project_path(project) %></div></td>
<td><div class="p_link"><%= link_to Nuke , project, :confirm => Are you sure? , :method => :delete %></div></td>
</tr>
</table>
<table>
<tr>
<td>
<% project.type_list.each do |tag|%>
<div class="p_tag">
<%= tag %>
<%= link_to "x", # %> <!-- THIS IS THE PART I M STUCK ON -->
</div>
<% end %>
</td>
</tr>
</table>
<table>
<tr>
<td>
<%= form_for(project) do |f| %>
<%= f.text_field :inject_tags %>
<%= f.submit "Add Tag" %>
<% end %>
</td>
</tr>
</table>
</div>
<% end %>
<br />
<%= link_to Add new project , new_project_path %>
</div>
谁能向我指出正确的方向? 我正确地执行这一规定,以便能够实际消除所描述的标签?
感谢gu!