This is tags controller with a remove action, it is supposed to render remove.js.erb
.
class TagsController < ApplicationController
def remove
@ticket = Ticket.find(params[:ticket_id])
if can?(:tag, @ticket.project) || current_user.admin?
@tag = Tag.find(params[:id])
@ticket.tags -= [@tag]
@ticket.save
end
end
end
This is the link that triggers the action, it is supposed to be asyncronous request to this action so it renders javascript instead of html.
<span class="tag" id="tag-<%= tag.name.parameterize %>">
<% if can?(:tag, @ticket.project) || current_user.admin? %>
<%= link_to "x",
:remote => true,
:url => remove_ticket_tag_path(@ticket, tag),
:method => :delete,
:html => { :id => "delete-#{tag.name.parameterize}" } %>
<% end %>
<%= tag.name %>
</span>
The problem is the remove
action doesn't render remove.js.erb
instead it returns an html page.