How to get has_secure_password to work in production?

I am using has_secure_password in a new application and it works fine locally. However, when deploying to our server and trying to start it, the following error message appears:

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

I did it bundle install

and that's it, so I'm not sure what's missing. I'm on Ruby 1.9.2p290 but I don't think this is the problem.



source to share

2 answers

I eventually realized that my last code was not pushed to GitHub when I did the Capistrano deployment. I added include ActiveModel::SecurePassword

to my WorkerLogin class but not checked. This line is required because I am using MongoDB / MongoMapper and it does not automatically include ActiveModel::SecurePassword

as ActiveRecord does.



In the Gemfile, uncomment or add this line:

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


and install the package



All Articles