Skip to content

Instantly share code, notes, and snippets.

@rujmah
Created April 17, 2012 16:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rujmah/2407359 to your computer and use it in GitHub Desktop.
Save rujmah/2407359 to your computer and use it in GitHub Desktop.
Mongoid implementation for authentication from scratch

Mongoid implementation of Ryan Bates authentication-from-scratch lesson on Railscasts.

Also uses 'username' rather than 'email' for validation

Commandline:

rails new authmongoid -O
cd authmongoid/

Gemfile:

gem 'bcrypt-ruby', :require => 'bcrypt'
gem 'mongoid'
gem 'bson_ext'

Commandline:

bundle
rails g mongoid:config
rails g controller users new
rails g model user username:string email:string password_hash:string password_salt:string
rails g controller sessions new
rm public/index.html
rails g controller home index

See Ryan's cast for more details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment