[Rails] Re: Questions on Managing Complex Objects
James Britt
james.britt at gmail.com
Tue Nov 23 00:29:40 GMT 2004
David Heinemeier Hansson wrote:
>> Do I need to code up 'before_destroy' someplace, and loop over owned
>> collections and explicitly call 'destroy' on each item?
>
>
> class Person
> has_many :phones, :dependent => true
> end
>
> ...by setting dependent to true, AR knows that it should destroy the
> phones when the person is destroyed.
Ah, quite sweet.
Perhaps this should be in the tutorial?
Thanks,
James
More information about the Rails
mailing list