Skip to content

Instantly share code, notes, and snippets.

@colinhoernig
Created October 17, 2014 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colinhoernig/82c311b4029d8e5ab193 to your computer and use it in GitHub Desktop.
Save colinhoernig/82c311b4029d8e5ab193 to your computer and use it in GitHub Desktop.
Custom session initializer for Ember Simple Auth...not currently working
import Ember from 'ember';
import Session from 'simple-auth/session';
var SessionWithUser = Session.extend({
user: function () {
var userId = this.get('user_id');
if (!Ember.isEmpty(userId)) {
return this.container.lookup('store:main').find('user', userId);
}
}.property('user_id')
});
export default {
name: 'customize-session',
before: 'simple-auth',
initialize: function(container){
container.register('session:custom', SessionWithUser);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment