Rails Delete Post with Tags or Comments

298 views Asked by At

I followed this guide on this website to add tagging to a post. I'm having an issue... http://www.sitepoint.com/tagging-scratch-rails/

Whenever I go to delete an post with tags i get this error:

enter image description here

Here is my code right here for the delete:

enter image description here

I'm still learning rails and I run into this issue whenever I have comments on a post and try to delete the post as well..

1

There are 1 answers

4
rxing On BEST ANSWER

You have set referential integrity constraints on your db.

There are still taggs in table taggings which reference to the post that you want to delete.

You need to delete taggings first before you can delete post.