emberjs Cannot clone an Ember.Object that does not implement Ember.Copyable

amique picture amique · Jan 25, 2014 · Viewed 7.1k times · Source

I am using ember 1.3.1 and ember-data 1.0.0-beta.5. On creating new mode I get following error

Assertion failed: Cannot clone an Ember.Object that does not implement Ember.Copyable

Following is my model code

App.myModel = DS.Model.extend({ name : DS.attr('string'), age : DS.attr('string') });

In my create route model function

return Em.Object.create({});

and finally on save I do following

this.store.createRecord('property', this.get('model'));

Although despite the error, my backend service is called successfully and new model is saved.

Please guide.

Thanks

Answer

Mario picture Mario · Mar 13, 2014

I had the same issue which I fixed by doing the following:
In the model function of the route replace

return Em.Object.create({});

with

return this.store.createRecord('myModel');

and on save replace

this.store.createRecord('myModel', this.get('model'));

with

this.get('model').save();