vendredi 20 février 2015

force hasmany with same ids

I want ember to list all foo's on {{#each foo}} even though the id's are the same.


This is my model.



App.Item = DS.Model.extend({
title: DS.attr("string"),
foo: DS.hasMany("foo", {async: true})
});

App.Foo = DS.Model.extend({
bar: DS.attr("string")
});


Let's say that foo is foo: [1] and the json response for that is:



{
"foos": [{
"id": 1,
"bar": "But is it _lightweight_ omakase?"
},
{
"id": 1,
"bar": "I for one welcome our new omakase overlords"
},
{
"id": 1,
"bar": "Put me on the fast track to a delicious dinner"
}]
}


Ember only lists the last object instead of everyone. I know that ember wants different ids, but is there a way to force ember to list all objects with same ids?


I'm using ember data and this is a read-only app.





Aucun commentaire:

Enregistrer un commentaire