ember.js - Just created entity with ember-data doesn't have its state set -
i use ember + ember data. when create entity after corresponding server side call state attributes (isloaded, isnew, isvalid, etc.) undefined. expectation these should set. example, before server side call expect isnew 'true' , after creation on server side expect isnew 'false'.
i creating enity way:
myentity = myapp.myentity.createrecord({attr1: "value1"}); ... myentity.transaction.commit();
what goes , forth is:
sent: {"myentity":{"attr1":"value1"}} ... received: {"myentity":{"id":2,"attr1":"value1","attr2":"value2"}}
the entity defined this:
myapp.myentity = ds.model.extend({ attr1: ds.attr("string"), attr2: ds.attr("string") });
unfortunately before , after remote call 'myentity' has state attributes 'undefined'. missing something?
thanks!
i guess problem not following naming conventions of ember data. myapp.myentity
going posted /my_entity
in case using default ds.restadapter
, ember data looking model in response under my_entity
or my_entitys
keys.
there possibility customize default behavior using map
function on app.adapter
.
Comments
Post a Comment