From 93cdac1aa4da78848ec632819149fdda3cb52488 Mon Sep 17 00:00:00 2001 From: Rebecca Anne Sealfon Date: Wed, 23 Jan 2013 13:38:06 -0500 Subject: [PATCH] NoMethodError on localhost: Undefined method password_salt --- Gemfile.lock | 2 +- app/models/user.rb | 1 + db/migrate/20120812151425_add_devise_to_users.rb | 3 ++- db/migrate/20121202224402_devise_create_users.rb | 12 ++++++------ db/migrate/20130123182620_add_salt_to_users.rb | 9 +++++++++ db/schema.rb | 3 ++- 6 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 db/migrate/20130123182620_add_salt_to_users.rb diff --git a/Gemfile.lock b/Gemfile.lock index 88c5ea85..41e16fc4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -157,7 +157,7 @@ GEM pry (~> 0.9.10) pry-rails (0.2.2) pry (>= 0.9.10) - rack (1.2.6) + rack (1.2.7) rack-mount (0.6.14) rack (>= 1.0.0) rack-test (0.5.7) diff --git a/app/models/user.rb b/app/models/user.rb index 4e9d61fe..1fa51239 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -33,6 +33,7 @@ class User < ActiveRecord::Base # last_sign_in_at : datetime # current_sign_in_ip : string # last_sign_in_ip : string + # salt : string # ======================= # Include default devise modules. Others available are: diff --git a/db/migrate/20120812151425_add_devise_to_users.rb b/db/migrate/20120812151425_add_devise_to_users.rb index 8bcb8eb0..01597c93 100644 --- a/db/migrate/20120812151425_add_devise_to_users.rb +++ b/db/migrate/20120812151425_add_devise_to_users.rb @@ -6,7 +6,7 @@ def self.up # t.rememberable # t.trackable - # t.encryptable + t.encryptable # t.confirmable # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both # t.token_authenticatable @@ -14,6 +14,7 @@ def self.up # Uncomment below if timestamps were not included in your original model. # t.timestamps + t.string :password_salt end # add_index :users, :email, :unique => true diff --git a/db/migrate/20121202224402_devise_create_users.rb b/db/migrate/20121202224402_devise_create_users.rb index 2106bf08..f80b1043 100644 --- a/db/migrate/20121202224402_devise_create_users.rb +++ b/db/migrate/20121202224402_devise_create_users.rb @@ -2,11 +2,11 @@ class DeviseCreateUsers < ActiveRecord::Migration def self.up change_table(:users) do |t| # t.database_authenticatable :null => false - # t.recoverable - # t.rememberable - # t.trackable + t.recoverable + t.rememberable + t.trackable - # t.encryptable + t.encryptable # t.confirmable # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both # t.token_authenticatable @@ -16,8 +16,8 @@ def self.up # t.timestamps end - # add_index :users, :email, :unique => true - # add_index :users, :reset_password_token, :unique => true + 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 diff --git a/db/migrate/20130123182620_add_salt_to_users.rb b/db/migrate/20130123182620_add_salt_to_users.rb new file mode 100644 index 00000000..11e8f531 --- /dev/null +++ b/db/migrate/20130123182620_add_salt_to_users.rb @@ -0,0 +1,9 @@ +class AddSaltToUsers < ActiveRecord::Migration + def self.up + add_column :users, :salt, :string + end + + def self.down + remove_column :users, :salt + end +end diff --git a/db/schema.rb b/db/schema.rb index 9ffbd7bd..bab27854 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20121229233342) do +ActiveRecord::Schema.define(:version => 20130123182620) do create_table "applics", :force => true do |t| t.integer "job_id" @@ -252,6 +252,7 @@ t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" + t.string "salt" end add_index "users", ["email"], :name => "index_users_on_email", :unique => true