0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Rails】ActiveRecord::RecordInvalid: Validation failed: Password is too shortの対処法

Posted at

症状

Railsでdeviceを導入後、rails db:seedでデータを作成しようとした際に下記エラーが発生しました。 翻訳すると、「検証に失敗しました:パスワードが短すぎます」でした。
seed.rb
3.times do |n|
    user = User.new(
      name: "testユーザー_#{n}",
      email: "email#{n}@yahoo.co.jp",
      password: "1234",
    )
end

解決方法

パスワードを6文字にして解決しました。
seed.rb
3.times do |n|
    user = User.new(
      name: "testユーザー_#{n}",
      email: "email#{n}@yahoo.co.jp",
      password: "123456",
    )
end
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?