Skip to content

Instantly share code, notes, and snippets.

@opsb
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save opsb/d3754a4541a120c92cad to your computer and use it in GitHub Desktop.

Select an option

Save opsb/d3754a4541a120c92cad to your computer and use it in GitHub Desktop.
Ember currentUser observer
Ember.SimpleAuth.Session.reopen({
updateCurrentUser: function() {
var self = this;
var userId = this.get('user_id');
if (!Ember.isEmpty(userId)) {
container.lookup('store:main').find('user', userId).then(function(user){
self.set("currentUser", user);
});
}
}.observes('user_id')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment