There are a few things missing. You can find the fixed fiddle here:
window.App = Ember.Application.create();
App.ApplicationAdapter = DS.FixtureAdapter;
App.Router.map(function () {
this.resource('profile', { path: '/' });
});
App.User = DS.Model.extend({
email: DS.attr('string')
});
App.User.FIXTURES = [
{
id: 1,
email: 'herpyderp@gmail.com'
}
];
App.ProfileRoute = Ember.Route.extend({
model: function() {
return this.store.find('user').then(function(users) {
return users.get('firstObject');
});
}
});
- Your template had the id
index
and not the name of the routeprofile
- You have to tell Ember specifically to use the fixture adapter.
- You accessed the model directly via the global object. You should let Ember do the work via the internal resolver and use
this.store.find
. .find()
returns a promise. You should get the first object in thethen
handler and return it there.