1

here my git https://gist.github.com/774510

the problem is if I'm using method:destroy in the _comments.html.erb I get sent to articles/1/comments, where no route matches, furthermore the comment doesn't get deleted

if I use method:delete, I get routed to the right page articles/1, but instead of deleting the comment, my app creates a new one :/

Kick Buttowski
  • 6,709
  • 13
  • 37
  • 58
malice
  • 82
  • 5

1 Answers1

2

I believe you need to tell rails that the comment is nested under articles OR just delete the comment in the comments controller:

1.)

# routes.rb
resources :articles do
  resources :comments
end

2.)

# _comments.html.erb
<%= link_to 'delete' comment, :method => :delete %>
sethvargo
  • 26,739
  • 10
  • 86
  • 156