discourse/discourse — pull request #1424 by goshakkk (2013-09-09 17:30:59+00:00)
Title: More DI

Store more singletons on container and inject them into controllers & routes. In routes & controllers, access their properties via regular `this.get`/`this.set` instead of `currentProp`.

It's not currently possible to inject these into models, because models need to be instantiated from a container to have the dependencies injected...

I'm thinking of an approach similar to that of ember-data (https://github.com/emberjs/data/blob/master/TRANSITION.md). Basically, instead of calling something like `App.Model.find(id)`, `store.find('modelName', id)` would need to be called, and `store#find` would take care of instantiating model through the container so that it gets its dependencies injected. Thoughts?