vendredi 20 février 2015

Ember-data: How DS.attr("number") supposed to work?

I'm using DS.RESTAdapter, php on server. I have a model UacList:



ds.Model.extend({
dummyFieldForErrors: ds.attr("string"),
selected: ds.attr("number"),
uacs: ds.hasMany("uac")
});


Ember sends request GET /rest/uacLists/1. Server response is:



{
"uacList":{
"id":1,
"selected":32483,
"uacs":[33618,9678,...,33656]
},
"uacs": [...]
}


But Ember Inspector tells me that selected is undefined (other attributes have values they should have according to server response). No matter if there is a quotes ("selected":"32483") or not ("selected":32483) - it is undefined anyway. If I define this attribute as string - it works, but I don't like when integer is defined as string.





Aucun commentaire:

Enregistrer un commentaire