Skip to content

Instantly share code, notes, and snippets.

@mattslay
Created April 17, 2012 15:06
Show Gist options
  • Save mattslay/2406616 to your computer and use it in GitHub Desktop.
Save mattslay/2406616 to your computer and use it in GitHub Desktop.
Devise_Admin_Create_User_Account
# When you do not want Users to be able to sign up for your site, rather, you want the admin to create the account and send them the login info.
class User < ActiveRecord::Base
def self.create_new_user(email, password)
user = User.new({ :email => email, :password => password })
return user.save
end
end
# This requires the admin to choose a password, so you could create a an algorithm to create
# a random 10-character string and email it to the user with the invite. The user can change that if they want.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment