Permalink
Browse files

Install devise

  • Loading branch information...
1 parent 51fa382 commit 4554de59b609607a66a54d4178a048ecb6eb5c6e @ihower committed Jul 20, 2012
Showing with 74 additions and 1 deletion.
  1. +1 −1 Gemfile
  2. +10 −0 Gemfile.lock
  3. +8 −0 app/models/user.rb
  4. +2 −0 config/routes.rb
  5. +53 −0 db/migrate/20120720141616_add_devise_to_users.rb
View
@@ -6,7 +6,7 @@ gem 'rails', '3.2.6'
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
-
+gem 'devise'
# Gems used only for assets and not required
# in production environments by default.
View
@@ -29,6 +29,7 @@ GEM
i18n (~> 0.6)
multi_json (~> 1.0)
arel (3.0.2)
+ bcrypt-ruby (3.0.1)
builder (3.0.0)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -37,6 +38,11 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.3.3)
+ devise (2.1.2)
+ bcrypt-ruby (~> 3.0)
+ orm_adapter (~> 0.1)
+ railties (~> 3.1)
+ warden (~> 1.2.1)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.4.0)
@@ -55,6 +61,7 @@ GEM
mime-types (1.19)
multi_json (1.3.6)
mysql2 (0.3.11)
+ orm_adapter (0.3.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
@@ -112,12 +119,15 @@ GEM
uglifier (1.2.6)
execjs (>= 0.3.0)
multi_json (~> 1.3)
+ warden (1.2.1)
+ rack (>= 1.0)
PLATFORMS
ruby
DEPENDENCIES
coffee-rails (~> 3.2.1)
+ devise
jquery-rails
mysql2
rails (= 3.2.6)
View
@@ -1,3 +1,11 @@
class User < ActiveRecord::Base
+ # Include default devise modules. Others available are:
+ # :token_authenticatable, :confirmable,
+ # :lockable, :timeoutable and :omniauthable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :trackable, :validatable
+
+ # Setup accessible (or protected) attributes for your model
+ attr_accessible :email, :password, :password_confirmation, :remember_me
attr_accessible :bio, :name
end
View
@@ -1,4 +1,6 @@
Sandbox::Application.routes.draw do
+ devise_for :users
+
resources :users
# The priority is based upon order of creation:
@@ -0,0 +1,53 @@
+class AddDeviseToUsers < ActiveRecord::Migration
+ def self.up
+ change_table(:users) do |t|
+ ## Database authenticatable
+ t.string :email, :null => false, :default => ""
+ t.string :encrypted_password, :null => false, :default => ""
+
+ ## Recoverable
+ t.string :reset_password_token
+ t.datetime :reset_password_sent_at
+
+ ## Rememberable
+ t.datetime :remember_created_at
+
+ ## Trackable
+ t.integer :sign_in_count, :default => 0
+ t.datetime :current_sign_in_at
+ t.datetime :last_sign_in_at
+ t.string :current_sign_in_ip
+ t.string :last_sign_in_ip
+
+ ## Confirmable
+ # t.string :confirmation_token
+ # t.datetime :confirmed_at
+ # t.datetime :confirmation_sent_at
+ # t.string :unconfirmed_email # Only if using reconfirmable
+
+ ## Lockable
+ # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
+ # t.datetime :locked_at
+
+ ## Token authenticatable
+ # t.string :authentication_token
+
+
+ # Uncomment below if timestamps were not included in your original model.
+ # t.timestamps
+ end
+
+ add_index :users, :email, :unique => true
+ add_index :users, :reset_password_token, :unique => true
+ # add_index :users, :confirmation_token, :unique => true
+ # add_index :users, :unlock_token, :unique => true
+ # add_index :users, :authentication_token, :unique => true
+ end
+
+ def self.down
+ # By default, we don't want to make any assumption about how to roll back a migration when your
+ # model already existed. Please edit below which fields you would like to remove in this migration.
+ raise ActiveRecord::IrreversibleMigration
+ end
+end

0 comments on commit 4554de5

Please sign in to comment.