Created
April 2, 2014 20:30
-
-
Save belison/9942492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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