Polymorphic destroy of resource

I have a folder class which has a folder_linkable, which links a
folder id to items via their id and class. If the folder is destroyed,
I want each linking destroyed, and then each item that is linked to
destroyed. I have in the FolderLinking class:

belongs_to :folder_linkable, :polymorphic =>
true, :dependent=> :destroy

but in my unit tests, the items that are connected with
folder_linkable are not destroyed. Does dependent destroy work with
polymorphic=>true?

Otherwise, should I overload destroy, destroying the item, and then
deleting the item via the class delete to avoid the recursive destroy?

I ran into the same problem a few days ago and havn’t found a solution
to
this. I really wonder if this is a bug (or a missing feature) in rails
or if
I’m just missing something.

Regards,
Timo

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs