OK after much frustration, I still can’t quite get a handle on this topic. Maybe I am just dull witted. But ember is really making me feel stupid on this particular topic. It is my major point of despair with the Ember framework.
Does anyone have a canonical example of deeply nested resources? Essentially a collection of collections of collections hierarchy at least three levels deep.
Here are two possible router examples
http://emberjs.jsbin.com/aVOtESa/1/edit
http://emberjs.jsbin.com/OPIBOkE/1/edit
Still not sure how to wire up the rest of this. Maybe I just have a fundamental misunderstanding of how to properly nest resources. And the difference between a resource
and a route
. Can someone help me with this bag of hurt? It is quite possible I am just being stubborn. But I don’t get it.
The data can be anything but I would love to see the two following routers implemented in functional JSBin examples.
App.Router.map(function() {
this.resource('libraries', function() {
this.route('new');
this.resource('library', {path: ':library_id'}, function() {
this.resource('books', function() {
this.route('new');
this.resource('book', {path: ':book_id'}, function() {
this.resource('pages', function() {
this.route('new');
this.resource('page', {path: ':page_id'}, function() {
}); // Page
}); // Pages
}); // Book
}); // Books
}); // Library
}); // Libraries
}); // map
A more abstract example
App.Router.map(function() {
this.resource('athings', function() {
this.resource('athing', { path: ':athing_id' }, function() {
this.resource('bthings', function() {
this.resource('bthing', { path: ':bthing_id' }, function() {
this.resource('cthings', function() {
this.resource('cthing', { path: ':cthing_id' }, function() {
}); // cthing
}); // cthings
}); // bthing
}); // bthings
}); // athing
}); // athings
});