A reader asked if I could add the destroy
action to CommentsController
for the sample blog in Rails Crash Course. The changes are summarized below.
I created a new branch called comments-destroy and then added the destroy action.
Here are the steps I followed:
- Update
config/routes.rb
to include a route for comments destroy - Add a
destroy
method toapp/controllers/comments_controller.rb
- Add a Destroy link to the comment partial at
app/views/comments/_comment.html.erb
The changes are in this commit: f410496
Note this is the same as Exercise 3 at the end of Chapter 5. The answers for all exercises are in the back of the book.
Hope this helps!
Hi Anthony,
I used your code but still facing problems. And sorry, I messed up the issue comment on github (used email to reply), and addressed you wrongly as Andrew :
https://github.com/railscrashcourse/blog/issues/1#issuecomment-79562156
Hope you can clean that up, sorry again.