Created
January 6, 2015 23:39
-
-
Save radar/b1fa1e1cb5dc08ec9e47 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def current_user | |
begin | |
@current_user ||= User.find(session[:user_id]) if session[:user_id] | |
rescue ActiveRecord::RecordNotFound | |
reset_session | |
end | |
end | |
helper_method :current_user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment