As you can see at those links:
As you can see all those questions are not answered. There is still need for documentation of code examples for copying/cloning an object in Ember Data.
What I still have so far is the following which does cloning of all attributes except hasMany items. And the drawback is that belongsTo items have to be done by hand.
var myItem= this.get('model').toJSON(), self = this; // todo implement getting hasMany items // set belongsTo items by hand myItem['someAttr'] = this.get('someAttr'); myItem['someAttr1'] = this.get('someAttr1'); myItem['someAttr2'] = this.get('someAttr2'); var duplicatedItem= this.store.createRecord('item', myItem);
So there are some points to improve:
- Saving of belongsTo not by hand
- Saving of hasMany items
A little new bump to get attention…