Created
December 20, 2011 23:19
-
-
Save anonymous/1503764 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
module SessionsHelper | |
def sign_in(user) | |
cookies.permanent.signed[:remember_token] = [user.id, user.salt] | |
self.current_user = user | |
end | |
def current_user=(user) | |
@current_user = user | |
end | |
def current_user | |
@current_user ||= user_from_remember_token | |
end | |
# From a tutorial, why wouldn't current_user= be defined as self.current_user= or why isn't self.current_user = user , current_user = user. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment