I use Ember + Ember Data. When I create an entity even after the corresponding server side call its state attributes (isLoaded, isNew, isValid, etc.) are all undefined. My expectation is that these should be properly set. For example, before the server side call I expect isNew to be 'true' and after the creation on the server side I expect isNew to be 'false'.
I am creating the enity this way:
myEntity = MyApp.MyEntity.createRecord({attr1: "value1"});
...
myEntity.transaction.commit();
What goes back and forth is:
Sent:
{"myEntity":{"attr1":"value1"}}
...
Received:
{"myEntity":{"id":2,"attr1":"value1","attr2":"value2"}}
The entity itself is defined like this:
MyApp.MyEntity = DS.Model.extend({
attr1: DS.attr("string"),
attr2: DS.attr("string")
});
Unfortunately before and after the remote call 'myEntity' has all state attributes as 'undefined'. Am I missing something?
Thanks!