Maybe you could get it to work with

p2.attributes = p1.attributes
p2.id = nil # so that it gets the auto-increment value from the
database/etc.
p2.save

Or use one of the strange hash.merge functions to combine your changes
to the p1.attributes.

Good luck!
-Kevin

On Jul 13, 6:20 am, wea_gruena <[email protected]> wrote:
> Hi all,
> the newbie is back ;-(
>
> Is it possible to create a copy of a record like this:
>
> [code]
> p1 = Profile.first(:name => 'ABC')
> p2 = p1.duplicate(:name => 'DEF')
> p2.save
> [/code]
>
> What's the best way to solve this problem ?
> Is it possible to copy / duplicate also associations etc. ?
>
> Thanks,
> Andreas

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to