This is my first project with EmberJS and Ember-CLI. I run the following commands:
ember new site //version: 0.1.2
ember generate resource categories
I get the following answer and the tests:
create app/models/category.js
create app/routes/categories.js
create app/templates/categories.hbs
ember generate resource category
I get the following answer and the tests:
create app/routes/category.js
create app/templates/category.hbs
identical app/models/category.js
The router.js file has:
Router.map(function() {
this.resource('categories', function() { });
this.resource('category', { path: 'categories/:category_id' }, function() { });
});
When I visit dev:4200/categories/1 I get the following error:
GET http://dev:4200/categories/1 404 (Not Found)
Error while processing route: category.index
Can anyone tell me what I'm missing? All the files are generated by ember-cli in their default state.
EDIT: I have a models/category.js
export default DS.Model.extend({
name: DS.attr()
});
And in the routes/category.js
export default Ember.Route.extend({
model: function(params){
console.log({category_id: params.category_id});
// return this.store.find('category', params.category_id);
}
});
The route dev:4200/categories/1 works and console.log shows the value Object {category_id: "1"} but with return this.store I get the error above.