I’d recommend a different approach to any of these. It seems you are going through a lot of ugly code to do something that should be relatively simple.
Using RSVP in the model hook looks good, however IMO the best way to deal with the returned promise is to assign the data to the appropriate controllers in the setupController hook, like so:
export default Ember.Route.extend({
model: function() {
return Ember.RSVP.hash({
projects: this.store.find('project'),
users: this.store.find('user'),
activities: this.store.find('activity')
});
},
setupController: function (controller, context) {
this.controllerFor('projects').set 'model', context.projects;
this.controllerFor('users').set 'model', context.users;
this.controllerFor('activities').set 'model', context.activities;
}
});
You can do this slightly less verbosely using something like @jhsu’s technique:
var RSVPRoute = Ember.Route.extend({
setupController: function(controller, model) {
for (var name in model) {
this.controllerFor(name).set('model', model[name]);
}
}
});
Controllers are supposed to wrap an object or a collection, which should be assigned to their model property. The techniques described in previous posts assign the objects as arbitrary properties of a single controller meaning they’re not wrapped in their respective controllers, which are designed for presenting data to templates.
Using the approach I suggest in this post means you can take advantage of all the features of controllers e.g. sortProperties in array controllers, and if desired can use the {{render}} helper to render the appropriate controller, view and model in your dashboard template.