Skip to content

Instantly share code, notes, and snippets.

@AlexanderZaytsev
Created January 14, 2013 21:22
Show Gist options
  • Save AlexanderZaytsev/4533631 to your computer and use it in GitHub Desktop.
Save AlexanderZaytsev/4533631 to your computer and use it in GitHub Desktop.
App.CurrentUserController = Ember.ObjectController.extend
init: ->
@setCurrentUserFromDom()
setCurrentUserFromDom: ->
attributes = $('meta[name="current-user"]').attr('content')
if attributes
attributes = JSON.parse(attributes)
App.store.load App.User, attributes
user = App.User.find attributes.id
@set 'content', user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment