In order to share code between my different routes (they are mostly the same), I am trying to do the following:
/// Base classes (not real routes)
App.RouteMixin = Ember.Mixin.create({
...
});
App.BaseIndexRoute = Ember.Route.extend(App.RouteMixin, {
...
});
/// NODES
App.rNodesMixin = Ember.Mixin.create({
...
});
App.NodesIndexRoute = App.BaseIndexRoute.extend(App.rNodesMixin, {
...
});
App.NodesShowRoute = App.BaseShowRoute.extend(App.rNodesMixin, {
...
});
App.NodesEditRoute = App.BaseEditRoute.extend(App.rNodesMixin, {
...
});
App.NodesNewRoute = App.BaseNewRoute.extend(App.rNodesMixin, {
...
});
/// AGENTS
App.rNodesMixin = Ember.Mixin.create({
...
});
App.AgentsIndexRoute = App.BaseIndexRoute.extend(App.rAgentsMixin, {
...
});
App.AgentsShowRoute = App.BaseShowRoute.extend(App.rAgentsMixin, {
...
});
App.AgentsEditRoute = App.BaseEditRoute.extend(App.rAgentsMixin, {
...
});
App.AgentsNewRoute = App.BaseNewRoute.extend(App.rAgentsMixin, {
...
});
And suddently I am getting the following errors:
Assertion failed: The attempt to linkTo route 'nodes.index' failed. The router did not find 'nodes.index' in its possible routes: 'index'
The same pattern has worked for the controllers. Is it not possible to reuse code for the routes, with mixin/extend?