I\'m trying to use dependent: :destroy without success.
Lets put a simple example. I create a simple application with the following:
rails g model parent
Calling the delete
method on an ActiveRecord derived object will issue a direct DELETE
statement do the database, skipping any ActiveRecord callbacks and configurations such as dependent: destroy
.
I believe you want the destroy
method.
You could also set up a foreign key in the database and set it to cascade on delete, it might make sense, depending on your needs.