Created
April 29, 2013 20:22
-
-
Save slottermoser/5484483 to your computer and use it in GitHub Desktop.
On-the-fly user creation in tkellem
This file contains 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
# on-the-fly authentication: create the user if the user doesn't already exist. | |
self.authentication_methods << proc do |username, password| | |
user = find_by_username(username) | |
if user.nil? | |
user = User.create(:username => username, :password => password) | |
user.save | |
user | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment