8.0 Deleting Comments

Another important feature of a blog is being able to delete spam
comments. To do this, we need to implement a link of some sort in the
view and a DELETE action in the CommentsController.
8.1 Deleting Associated Objects

If you delete a post then its associated comments will also need to be
deleted. Otherwise they would simply occupy space in the database. Rails
allows you to use the dependent option of an association to achieve
this. Modify the Post model, app/models/post.rb, as follows: