Polymorphic destroy of resource

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?

This doesn’t work:

class FolderLinking < ActiveRecord::Base

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

when an instance of FolderLinking is destroyed, I want the item that
it links to destroyed. I’m currently seeing the folder_linkable
sticking around.

Yottameter <[email protected]…> writes:

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

Specifying :dependent=> :destroy on the has_one declaration causes the
“parent”
to be destroyed with the resource. You must, however, destroy the
resource, not
the parent, which seems a bit upside-down.

-wcpr-

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