Migrating from has_secure_password to devise causes the following error in the console when interacting with user objects:
.rvm/gems/ruby-2.4.1/gems/devise-4.4.0/lib/devise/models/database_authenticatable.rb:166:in `password_digest'
I understand this is because devise uses the pasword_digest function and so it is incompatible with the password_digest column used by active record's has_secure password.
A solution is to delete the password_digest column from the db but I do not want to loose existing users' passwords.
Should I delete the encrypted_password column devise created and then do a migration to rename password_digest to encrypted_password and then update existing user's passwords or is there a more appropriate solution?
1> Rename the column password_digest to encrypted_password.
2> In devise initializer in config/initializers/devise.rb set
config.stretches = 11 # this is default
3> bcrypt is the default hashing or encryption algorithm(so no change needed).
See devise config template.
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