In order to have friendlier names to my column, I ran the following migration :
class RenameDigestColumnsOnUserToEncryptedTokens < ActiveRecord::Migration[5.0]
def change
rename_column :users, :password_digest, :encrypted_password
rename_column :users, :activation_digest, :encrypted_activation_token
rename_column :users, :reset_digest, :encrypted_reset_password_token
end
end
It worked well, the columns are effectively renamed in my database.
I renamed accordingly all the actions I could have with these names, which means I don't have anything remaining in my code with whether Password_digest, activation_digest or reset_digest.
The problem is when I run the tests, I still get the errors as if I hadn't renamed them in the project, i.e. this kind of errors :
.E
Error:
PasswordResetsTest#test_password_resets:
NoMethodError: undefined method `password_digest' for #<User:0x00563d149684d8>
Did you mean? password
app/controllers/password_resets_controller.rb:29:in `update'
test/integration/password_resets_test.rb:42:in `block in <class:PasswordResetsTest>'
bin/rails test test/integration/password_resets_test.rb:10
I tried restarting spring and even rebooting the computer, I can't see where it comes from, how the computer can still see these names.
I am using the bcrypt gem to generate encrypted tokens, formerly named with digest, and this is those ones I tried to rename.
Has anyone ever had this problem ? Thanks in advance for your help.
Aucun commentaire:
Enregistrer un commentaire