emberjs/ember.js — pull request #1900 by rlivsey (2013-01-27 23:45:39+00:00)
Title: Proposal - route mounting so you can build up a router in distinct chunks

This has come up a few times (eg #1847, #1888) where people want to define their router in chunks.

This adds in `Router.define` to define a set of routes which can be mounted in your router with `this.mount('name')` like so:

App.Router.define("blog", function() {
this.route("post", {path: "/:post_id"});
});

App.Router.map(function() {
this.mount("blog");
});

is the equivalent to:

App.Router.map(function() {
this.resource("blog", function() {
this.route("post", {path: "/:post_id"});
});
});

As it's basically just syntactic sugar for a resource you can mount it anywhere in your router and set the options, eg:

App.Router.map(function() {
this.resource("stuff", function() {
this.mount("blog", {path: '/news');
});
});

I'm not 100% sure on the implementation, but hopefully will kick off a discussion at least.