dtrusty-U6r7FCv0h4VBDgjK7y7TUQ@public.gmane.org
2006-Dec-08 16:00 UTC
How to debug dependent=>destroy being ignored?
Hi, I have a has_many :children, :dependent=>:destroy association. For some reason, when I delete the parent, the children are not destroyed. In the log, I can see the parent being deleted, but nothing related to the child table is shown. I do use the association to create entries in the child table. How do I debug this problem? Thanks, David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
dtrusty-U6r7FCv0h4VBDgjK7y7TUQ@public.gmane.org
2006-Dec-08 21:23 UTC
Re: How to debug dependent=>destroy being ignored?
dtrusty-U6r7FCv0h4VBDgjK7y7TUQ@public.gmane.org wrote:> Hi, > > I have a has_many :children, :dependent=>:destroy association. > For some reason, when I delete the parent, the children are not > destroyed. > > In the log, I can see the parent being deleted, but nothing related to > the child table is shown. > I do use the association to create entries in the child table. > > How do I debug this problem? > > Thanks, > > DavidI found the cause of this problem. If I call the Parent.delete with a set of ID''s, it doesn''t delete the children. I must do a Parent.destroy for the children to be deleted. David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---