Reputation: 763
Somehow the parameter user_id
is not being passed to my UserIndexRoute. What could be going wrong?
The error I'm getting as a result is
Assertion Failed: You may not pass
undefined
as id to the store's find method
router.js
var Router = Ember.Router.extend({
location: DaappEmber2ENV.locationType
});
Router.map(function() {
this.resource('users', function(){
this.resource('user', { path:'/:user_id' }, function(){
this.route('edit');
});
this.route('create');
});
});
export default Router;
routes/user/index.js
export default Ember.Route.extend({
model: function(params){
Ember.Logger.debug('Params for user/index route:', params);
return this.store.find('user', params.user_id);
}
});
Upvotes: 1
Views: 1313
Reputation: 47367
You've defined a dynamic slug, user_id on the users route, but then you are trying to access it on the usersindex route. Child route's don't inherit params from their parent resources. Create a users route and it will be available there.
Upvotes: 7