Reputation: 21877
How do I use the link_to
method, to utilize the remove_tag
action?
issues_controller.rb
def remove_tag
@issue.remove_it
end
issue.rb
def remove_it
self.users.delete(User.find(1))
end
Upvotes: 0
Views: 3537
Reputation: 83680
<%= link_to "Remove Tag", remove_tag_issue_path(@issue) %>
or
<%= link_to "Remove Tag", [:remove_tag, @issue] %>
And remove_tag
action should be presented in routes as member
for issue resources
Upvotes: 2
Reputation: 4829
It depends on how you have set your routes. You might need to use a named route for that action as it is not a standard resource route.
I suggest you read this:
http://guides.rubyonrails.org/routing.html
lint_to uses whatever is defined in routing
Upvotes: 1