Datamapper Clone Record w/ New ID

Posted by BouncePast on Stack Overflow See other posts from Stack Overflow or by BouncePast
Published on 2010-04-19T17:41:28Z Indexed on 2010/04/19 17:43 UTC
Read the original article Hit count: 266

class Item

include DataMapper::Resource property :id, Serial property :title, String end

item = Item.new(:title => 'Title 1') # :id => 1 item_clone = Item.first(:id => 1).clone item_clone.save

This does "clone" the object as described but how can this be done so it applies a different ID once the record is saved, e.g. #

© Stack Overflow or respective owner

Related posts about datamapper

Related posts about database