Dependent => :destroy order assured?

Hello,
I already entered this question, but I guess it was too verbose :slight_smile:

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

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

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 G. 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