I came across this post describing how to tell Ember Data's adapter that the JSON payload is coming in embedded:
// data.json
{
company: {
id: "Acme Inc.",
contracts: [
{
date: 2013-02-03,
...
},
...
]
}
}
// models.js
App.Company = DS.Model.extend({
contracts: DS.hasMany('App.Contract')
});
App.Contract = DS.Model.extend({
company: DS.belongsTo('App.Company'),
...
});
DS.RESTAdapter.map('App.Company', {
contracts: { embedded: 'always' }
};
My question is, how can I do this for multiple levels of nesting?
// data.json
{
company: {
id: "Acme Inc.",
contracts: [
{
date: 2013-02-03,
...
schedules: [
{
amount: 1,402,
...
},
...
},
...
]
}
}
I tried adding
DS.RESTAdapter.map('App.Contract', {
schedules: { embedded: 'always' }
};
but it didn't work.