jeudi 29 janvier 2015

Ember.js - Error while processing route if URL hit directly

I keep getting the following error from the route handler for a single object (user). If I click the link to view/show a single object (user) it works fine, but when I refresh the page at this route's url I keep getting this error.


URL that causes the error when visiting directly:



/users/:user_id


Error message in console:



Error while processing route: users.show Assertion Failed: Expected an
object as `data` in a call to `push`/`update` for ember-app@model:user:,
but was undefined Error: Assertion Failed: Expected an object as `data`
in a call to `push`/`update` for ember-app@model:user: , but was undefined


app/router.js



Router.map(function() {
this.resource('users', function() {
this.route('show', { path: '/:user_id' });
});
});


app/routes/users/show.js



export default Ember.Route.extend({
model: function(params) {
console.log('show route model hook'); //Hook firing on refresh
return this.store.find('user', params.user_id);
}
});


I am using Ember 1.8.1 and Ember-Data 1.0.0-beta.12. Any help will be greatly appreciated!





Aucun commentaire:

Enregistrer un commentaire