ruby on rails - Evaluating :dependent => :destroy -
In Rail 2.2.2 (ruby 1.8.7-p72), I want to evaluate the effect of deleting an object I'm actually doing this before, of course. I would like to be able to generate a list of all those objects: Dependent =>: Destroy (through organizations of any object) I am trying to solve the problem, the user has to give a list of all the things Those who will be removed and have to confirm the action.
Can someone recommend a good way to go about this? I have just begun to appear in ActiveRecord :: Associations, but I have not made much progress.
Update: In my special case, I have the object (A -> B - - C).
It should help you get started ... obviously you have to customize it but this is all The Association lists the names that are dependent on that blog blog:
BlogEntry.reflect_on_all_associations.map do | Association | If the association Option [: Dependent] ==: Delete # Do something here ... Association. Name & End & Support; & Gt; [: Tagging: Comments]
Comments
Post a Comment