Try the following:
x = Item.new x.save y = x.clone y.save
It should change _id and copy all other fields. I noticed that this does not seem to work with inline documents. For each embedded document in the original, it creates an empty subdocument in the clone with a new identifier, but does not fill out any of the other fields.
If you work with embedded documents, it is better to write your own class method.
Vickash
source share