Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get has_secure_password to work in production?

I'm using has_secure_password in a new application and it works great locally. However, when I deploy to our server and try to run it I get the following error message:

undefined local variable or method `has_secure_password' for WorkerLogin:Class

I did a bundle install and everything so I'm not sure what's missing. I'm on ruby 1.9.2p290 but I don't think that would be the problem.

Thoughts?

like image 661
Max Schmeling Avatar asked Dec 27 '25 17:12

Max Schmeling


2 Answers

I eventually realized I didn't have my latest code pushed to GitHub yet when I did the Capistrano deployment. I had include ActiveModel::SecurePassword added to my WorkerLogin class but not checked in. This line is required because I'm using MongoDB/MongoMapper and it doesn't automatically include ActiveModel::SecurePassword like ActiveRecord does.

like image 88
Max Schmeling Avatar answered Dec 30 '25 15:12

Max Schmeling


In Gemfile uncomment or add this line:

gem 'bcrypt-ruby', '~> 3.0.0'

and run bundle install

like image 33
Victor Rodrigues Avatar answered Dec 30 '25 16:12

Victor Rodrigues