Skip to content

Instantly share code, notes, and snippets.

@belison
Created April 2, 2014 20:30
Show Gist options
  • Save belison/9942492 to your computer and use it in GitHub Desktop.
Save belison/9942492 to your computer and use it in GitHub Desktop.
Ember.Application.initializer({
name: 'currentUser',
initialize: function(container, application) {
var user,
store = container.lookup('store:main'),
attributes = $('meta[name="current-user"]').attr('content');
if (attributes) {
var serializer = store.serializerFor(App.User);
var serializedUser = serializer.normalize(App.User, JSON.parse(attributes));
user = store.push(App.User, serializedUser);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment