LoginSignup
8
8

More than 5 years have passed since last update.

ユーザ情報更新時のhas_secure_passwordによるパスワードチェックの回避

Last updated at Posted at 2014-10-08

ユーザ情報更新時にpasswordチェックを回避したい

非常に便利なhas_secure_password。
でもupdate時に必ずパスワード確認するっぽく、パスワード情報をいれないと他のデータの更新ができないっぽい。
管理者権限でユーザ情報の更新をしたいので、create時のみパスワードを設定するよう変更したい。

app/model/user.rb
has_secure_password
validates :password, length:{minimum:6}, confirmation: true, on: :create

参考

8
8
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
8
8