From: pbooth@... Date: 2009-08-12T02:34:30+09:00 Subject: Fwd: Destroying related objects doubt ... basic oop question > > This is a great OO question, rather than a Ruby question. > > But here, I think the question isn't related data but owned data. If > the containing object is a shopping cart, that contains items, then > it's easy to see that destroy means destroy children, and that in > general this applies to persistent and in-memory representations > > > > Sent from my iPhone > > On Aug 10, 2009, at 1:39 PM, Soh Dubom wrote: > >> ::Destroying related objects doubt >> >> One thing that is confusing me is regarding the lifecycle of the >> associated objects and the related data in the database. Suppose we >> have >> an example of object composition and in this case if I destroy de >> parent >> object then the children objects will be destroyed too. >> >> Well, the confusion I'm doing is related to the semantics of the word >> 'destroy'. In my understanding when I say 'destroy' an object, it >> means >> I will unset it, but I will not 'delete' the related data in the >> database. >> >> ex.: let's say we have objects House and Rooms, the relationship >> between >> them is composition, so House is responsible for creating new >> Rooms. If >> I destroy the instance of House, all instances of Rooms will be >> destroyed as well, but it doesn't mean I have to 'delete' them from >> the >> database, right? ... sounds like a silly question, but ... >> >> thanks in advance, sohdubom >> -- >> Posted via http://www.ruby-forum.com/. >>