Simple-auth session in model


Is there a way to access the session object from inside of the model?


Possible solution which works:

// TODO: This can be removed when upgraded to Ember 2.4+
// Unfortunately, simple-auth doesn't inject the session into model, so
// in order to do that, I created my own initializer. After simple-auth
// is initialized, I do it myself.
export function initialize(container, application) {
    application.inject('model', 'session', 'simple-auth-session:main');

export default {
    name: 'inject-session-in-model',
    after: ['simple-auth'],


jup or just use service injection per model if its not required everywhere


Sure, but session is kind of an important global setting, so I purposely make it available in all models.