I have multiple classes with many associations linking them together and I would like to be able to take the top-level object, close it, and have all of the child-objects closed as well. I need each object to be closed because I want to be able to pick any parent and have all of it's children closed.
For example (I realize this probably doesn't exist):
class Requisition
has_many :shipments, :dependent_method => :close
end
class Shipment
belongs_to :requisition
has_many :reroutes, :dependent_method => :close
end
class Reroute
belongs_to :shipment
has_many :deliveries, :dependent_method => :close
end
class Delivery
belongs_to :reroute
end
Does anybody know of a good solution to achieve this? A gem/plugin would be perfectly acceptable :-)
Thanks much!