Skip to content

Instantly share code, notes, and snippets.

@baileylo
Created October 6, 2010 08:38
Show Gist options
  • Save baileylo/613028 to your computer and use it in GitHub Desktop.
Save baileylo/613028 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
private
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session && current_user_session.record
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment