LoginSignup
0
0

More than 3 years have passed since last update.

railsのdeviseではhas_secure_passwordはいらない

Last updated at Posted at 2020-12-04

deviseを使用しており、password_digestを使おうとuserモデルにhas_secure_passwordを追加したら、「undefined method `password_digest=' for #<> Did you mean? password_digest」というエラーが出た。

結論

deviseはhas_secure_password の代わりにencrypt_passwordを使用している。
よって、userモデルにhas_secure_passwordを追加する必要はない。

マイグレーションファイルを見てみると、

t.string :encrypted_password, null: false, default: ""

と確かに書いてあった。

参考:https://qiita.com/kents1002/items/4079e3d05d322febe00e

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0