Skip to content

Instantly share code, notes, and snippets.

@jstewart
Created August 18, 2010 13:22
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 jstewart/534709 to your computer and use it in GitHub Desktop.
Save jstewart/534709 to your computer and use it in GitHub Desktop.
# In user model
def current
Thread.current[:current_user]
end
def current=(user)
Thread.current[:current_user] = user
end
# Application controller
before_filter :set_current_user
def set_current_user
User.current = current_user if current_user
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment