Custom URL to models


#1

Hello folks, I started with ember a few days and was a bit confused about somethings, the problem i want to fix first is:

Following the guide and adapting to my needs i ended up with this routes:

PP.Router.map(function() {
 this.resource('index', { path: '/' });
});
PP.IndexRoute = Ember.Route.extend({
 model: function(){
 return this.store.find('category');
 }
});

One model:

PP.Category = DS.Model.extend({
 parent_id: DS.attr(),
 name: DS.attr(),
 classname: DS.attr(),
 sprite: DS.attr(),
});

When i access the index page ember load the data from webservice perfectly, something like: http://localhost/myapp/api/category

My problem is i need to make a request to this URL: http://localhost/myapp/api/category/roots

This url return only the root level categories, so, how can i achive this?

To clarify better i need to request these URLs: localhost/myapp/api/category (all categories) localhost/myapp/api/category/:id (single category) localhost/myapp/api/category/roots (only categories roots) localhost/myapp/api/category/children/:id (chidrens of category :id )

Thanks