My Json Data looks like this:
{"user":{"id":1,
"name":"bob",
"profile":{"id":1,
"forename":"Foo",
"surname":"Bar",
"user_id":1}}
My model looks like:
App.User = DS.Model.extend({
name: DS.attr('string'),
profile: DS.belongsTo('App.Profile')
});
and
App.Profile = DS.Model.extend({
forename: DS.attr('string'),
surname: DS.attr('string'),,
user: DS.belongsTo('App.User')
});
When I try to get {{user.name}}, it works fine. user.profile.forename doesnt work. I tried for my user model
DS.AuthenticatedRESTAdapter.map('App.User', {
profile: {embedded: true}
});
as well, but still doenst work. Any suggestions?
What is missing is configuring the serializer (used by the adapter) by calling its ‘map’ function:
You can find a working example at JFiddle here.