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?