I have a custom
User model with lots of rows. I have a
password_digest column that I want to keep. (it comes from
And I also want to use Devise database authenticatable, but from my limited knowledge on Devise, I have to use the encrypted_password column.
Is there a way to trick Devise into using my current
password_digest for authentication, so I don't lose all my User passwords?
If I add an
encrypted_password column it will be blank and I definitely don't want it to stay like that.
I'm probably thinking about this the wrong way. What's the right way to solve this?
Simply write a migration to rename the column name, it will not loose your data.
rails g migration ChangeColumnName
this will generate a migration file
class ChangeColumnName < ActiveRecord::Migration def change rename_column :users, :password_digest, :encrypted_password end end