You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this applies to Rails 5 or only an older version that the Blogger tutorial was created for.
Now that we can see all of our tags, we also want the capability to delete them. I think you can do this one on your own too. Create a destroy action in your tags_controller.rb and edit the index.html.erb file you just created. Look at your articles_controller.rb and Article show.html.erb if you need some clues.
With that, a long Iteration 3 is complete!
During this DIY step, a foreign key error was raised when I tried to delete a Tag the same way as taught for Articles. ActiveRecord::InvalidForeignKey (SQLite3::ConstraintException: FOREIGN KEY constraint failed: DELETE FROM "tags" WHERE "tags"."id" = ?):
I'm not sure if this applies to Rails 5 or only an older version that the Blogger tutorial was created for.
During this DIY step, a foreign key error was raised when I tried to delete a Tag the same way as taught for Articles.
ActiveRecord::InvalidForeignKey (SQLite3::ConstraintException: FOREIGN KEY constraint failed: DELETE FROM "tags" WHERE "tags"."id" = ?):
I solved it by (as on SO: https://stackoverflow.com/a/1905498) deleting the related Taggings first,
but this is not even hinted at in the text, and
ActiveRecord::QueryMethods#where
hasn't been introduced at this stage.Could one of the authors please give a Best Practice for deleting a tag without errors, and amend the tutorial text if necessary?
The text was updated successfully, but these errors were encountered: