Resources with same name and namespacing


#1

Im trying to figure out how I can name items the same thing under a different resource.

To give an example:

App.Router.map(function() {
    this.resource('admin', function() {
        this.resource('sources', function() {
            this.route('new');
            this.resource('source', { path: '/:source_id' }, function() {
                this.route('edit');
                this.resource('revisions', function(){
                    this.route('new');
                });
            });
        });
        this.resource('controlModules', function() {
            this.route('new');
            this.resource('controlModule', { path: '/:controlModule_id'}, function() {
                this.route('edit');
                this.resource('revisions', function(){
                    this.route('new');
                });
            });
        });
    });
});

What if I declared a new namespace

CM = Ember.Namespace.create({}); then did

CM.Router.map(function(){
 this.resource('admin', function() {
       this.resource('controlModules', function() {
                this.route('new');
                this.resource('controlModule', { path: '/:controlModule_id'}, function() {
                    this.route('edit');
                    this.resource('revisions', function(){
                        this.route('new');
                    });
                });
            });
        });
   });

Can you link to a resource thats in a different namespace? And can you even have multiple routers on the same page? for example if I was looking at controlModules but wanted to linkto sources how would that work?

The other benefit of this would be that since my ember data models are different but want the same name they would be namespaced as well.

CM.Revision = DS.Model.extend()
App.Revision = DS.Model.extend()

I know to get around this problem you can just say this.resource(‘controlModule.revisions’) but that starts to get unruly and long after a point.