Hello, I already entered this question, but I guess it was too verbose :-) Given the following class Person < ActiveRecord::Base has_many :books, :dependent => :destroy has_many :movies, :dependent => :destroy end can I assume that destroying an object of type Person _first_ books are destroyed and only _then_ movies follow the same destiny? My tests confirm that this is the case, but I found no documentation. Does anybody know more on this topic? Thanks! Mauro -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''m not sure if this would be the case. How would foreign keys be handled in that instance? The destroy could block on a movie with a person_id set to the current Person, wouldn''t it? Vish On 10/8/06, Mauro Cicio <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Hello, > I already entered this question, but I guess it was too verbose :-) > > Given the following > > class Person < ActiveRecord::Base > has_many :books, :dependent => :destroy > has_many :movies, :dependent => :destroy > end > > can I assume that destroying an object of type Person > _first_ books are destroyed and only _then_ movies follow the same > destiny? > > My tests confirm that this is the case, but I found no documentation. > Does anybody know more on this topic? > > Thanks! > Mauro > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Books and Movies are destroied all right, according to the documentation. What is not documented, as far as I know, is if I can rely on the order of distruction. Mauro Vishnu Gopal wrote:> I''m not sure if this would be the case. How would foreign keys be > handled in > that instance? The destroy could block on a movie with a person_id set > to > the current Person, wouldn''t it? > > Vish-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---