Skip to content

Instantly share code, notes, and snippets.

@slottermoser
Created April 29, 2013 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slottermoser/5484483 to your computer and use it in GitHub Desktop.
Save slottermoser/5484483 to your computer and use it in GitHub Desktop.
On-the-fly user creation in tkellem
# 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