Pasted from the docs, two models
App.Post = DS.Model.extend({
comments: DS.hasMany('comment', {async: true})
});
App.Comment = DS.Model.extend({
post: DS.belongsTo('post')
});
Expected data format
{
"post": {
"comments": [1, 2, 3]
}
}
{
"comment": {
"post": 1
}
}
Having
"comments": [1, 2, 3]
Makes the whole thing awkward with a relational schema. Why not just
{
"post": { }
}
{
"comment": {
"post": 1
}
}
And starting with a post have Ember Data somehow make a request for all comments belonging to a post? Is it because there is no REST representation for belongsTo? Can an adapter be wired in somewhere to do this automatically so I don’t have to do weird json manipulations?