Hi there,
I have a Rails app with several has_many relationships, which in turn have several has_many relationships.
Let's say that I have an 'enabled' field in each table, that can be either true or false.
If I disable a Widget, not only do I want the Widget's enabled column to be set to false, I also want it's 'children's' enabled column to be set to false.
I want the ability to disable something and then re-enable it, and have its dependents follow suit. So, as a lame example:
A Dog has_many Dishes a Dog has_many Collars
A Dish has_many Kibble A Collar has_many Leashes
If I disable the Dog, I want all of its Dishes, Collars, Kibble, and Leashes disabled. Then, I want to be able to go back in and enable the Dog - if I do this, I want its Dishes, Collars, Kibble, and Leashes enabled.
I've been looking at several things, including nasty, resource heavy recursion using reflections and the collect method to grab ids, as well as trying to wrap my head around whether or not callbacks would be helpful in this situation.
Can anyone please please *please* point me in the right direction?
Thanks in advance - it's greatly appreciated!
Samantha