Datamapper Clone Record w/ New ID
- by BouncePast
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. #