Created
January 19, 2013 03:39
-
-
Save augustf/4570639 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
In the application controller: | |
#call on this method to get access to the current user session in models (used in Task model for cocaine) | |
def set_current_user | |
User.current = current_user | |
end | |
In the User model: | |
#used to fetch the current user session in models | |
def self.current | |
Thread.current[:user] | |
end | |
#used to fetch the current user session in models | |
def self.current=(user) | |
Thread.current[:user] = user | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment