mardi 6 janvier 2015

EmberJS Data HasMany relationship parent jon contains whole object not ids

EmberJS Data HasMany relationship parent jon contains whole object not ids



App.Message = someParentClass.extend({
childMessages: DS.hasMany('ChildMessage'),
message:DS.attr('string',{defaultValue: ""})
}

App.ChildMessage = someParentClass.extend({
message: DS.attr('string',{defaultValue: ""}),
code:DS.attr('string',{defaultValue: ""})
}


and the JSON looks like this



{
"message":"xyz",
"childMessages":[{"code":"we","message":""},{"code":"uh","message":""},{"code":"wd","message":""}]
}


after fetching the object, code and message for child messages are undefined (not getting populated)


changing json in not in my hand


Please help





Aucun commentaire:

Enregistrer un commentaire