From: Robert Klemme Date: 2006-02-02T06:39:33+09:00 Subject: Re: misunderstanding the Passing of references Matthew Smillie wrote: > On Jan 30, 2006, at 6:43, Todd S. wrote: >> In reading the link you suggest it seems I >> would have to use a seperate data dumping operation. This seems a >> little strange to me. Shouldn't there be a more simple way to >> create a >> copy of an object? >> > > There is and there isn't: Object#dup and #clone both make shallow > copies: > http://ruby-doc.org/core/classes/Object.html#M001067 > > There's no built-in method to create deep copies of any object, > though, and the serialise/unserialise thing just hacks around that in > the quickest way (as in, quickest to write). > > If it were me, unless the Model class was extraordinarily > complicated, I'd probably just write my own copy method. You can as well override or reimplement the #dup method. robert