How to make a deep copy of ActiveRecord

I wanna make a method that can deep copy an ActiveRecord to a new one,
but it seems a little difficult , how to do it?

On 7/26/07, gaoxt1983 [email protected] wrote:

I wanna make a method that can deep copy an ActiveRecord to a new one,
but it seems a little difficult , how to do it?

Marshal::load(Marshal::dump(object))

Gustav P.

I think the question’s more about creating a new record that has all of
the relationships?

All the Marshal trick does is create an identical copy.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs