0

我正在使用devise,我不能通过 no via 添加用户seeds.rb。这是一个rails控制台:

irb(main):100:0> a = User.new
=> #<User id: nil, email: "", encrypted_password: "", reset_password_token: nil, reset_password_sent_at: nil,......etc>
irb(main):111:0> a.email = "email1@gmail.com"
=> "email1@gmail.com"

irb(main):116:0> a.password = "1234a"
=> "1234a"
irb(main):117:0> a.password
=> "1234a"
irb(main):119:0> a.password_confirmation = "1234a"
=> "1234a"
irb(main):120:0> a.password_confirmation == a.password
=> true
irb(main):121:0> a.save!
   (0.8ms)  BEGIN
  User Load (1.2ms)  SELECT "users".* FROM "users" WHERE "users"."reset_password_token" = 'M9Xg7pYuPkgysuirxoj8' LIMIT 1
  User Load (1.1ms)  SELECT "users".* FROM "users" WHERE "users"."reset_password_token" = '4y8Vdn9b7nsC2QqtkCSs' LIMIT 1
  User Exists (0.7ms)  SELECT 1 AS one FROM "users" WHERE "users"."email" = 'email1@gmail.com' LIMIT 1
  User Exists (0.8ms)  SELECT 1 AS one FROM "users" WHERE LOWER("users"."login") = LOWER('login1') LIMIT 1
  User Exists (0.6ms)  SELECT 1 AS one FROM "users" WHERE "users"."email" = 'email1@gmail.com' LIMIT 1
   (0.4ms)  ROLLBACK
ActiveRecord::RecordInvalid: Validation failed: Password doesn't match confirmation
4

0 回答 0