I have commented everything out of my model except:
has_secure_password
and with my migration I have added:
t.string "password_digest"
to my users database.
When I create a user in the rails console and try to save it however, the password doesn't encrypt. It appears in my database as the password that I entered. Could someone please tell me how to get has_secure_password to encrypt my password? Am I missing something simple? I have the bcrypt gem installed.
Yes. For others that come by this post and aren't quite sure what you mean.
You don't assign a password to password_digest
You assign it to password
When you add has_secure_password to your model, it automatically adds a virtual attribute called password. When you assign a value to password, it will encrypt and save into password_digest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With