How to handle orphans?

The requirements for my Web app have changed and now instead of
destroying an
object and all children when it expires, I need to destroy the parent
object
when the last child is destroyed. Is there a builtin or gem to do this?
Is
it better to check the cached count in the parent (reference counting)
and
destroy it when drops to zero when each child is destroyed or
periodically
scan for parents with no children and destroy them then (garbage
collection)?

TIA,
Jeffrey

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