Skip to content

Instantly share code, notes, and snippets.

@latpaw
Created June 14, 2012 09:53
Show Gist options
  • Save latpaw/2929369 to your computer and use it in GitHub Desktop.
Save latpaw/2929369 to your computer and use it in GitHub Desktop.
acts as taggable on , delete a tag
def remove_tag
@project = Project.find(params[:id])
@project.type_list.remove(params[:tag])
@project.save
redirect_to projects_path, :flash => { :success => "Updated - tag nuked."}
end
Updated route:
resources :projects
match 'projects/:id/remove_tag/:tag' => 'projects#remove_tag'
<% project.type_list.each do |tag|%>
<div class="p_tag">
<%= tag %>
<%= link_to 'x', {:action => "remove_tag", :id => project.id, :tag => tag,
:controller => "projects"} %>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment