February 26, 2017
Here are some things to do to ensure that you can use has_secure_password in your Rails app using Mongoid (Note, my class name is developer. Yours might be user or something else) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
class Developer include Mongoid::Document #Include this class in your class include ActiveModel::SecurePassword field :first_name, type: String field :last_name, type: String field :title, type: String field :bio, type: String field :email, type: String field :city, type: String field :state, type: String #Instead of password, create a password digest field field :password_digest #Make sure this is in the model has_secure_password end |
If you scaffolded the user, you might see that password_digest is in the form as a text field. You will want […]
Read more