使用rails中的devise重新确认新电子邮件不起作用

时间:2014-08-29 21:15:10

标签: ruby-on-rails ruby-on-rails-4 devise devise-confirmable

我正在尝试在控制台中手动重新确认电子邮件。首先,用户看起来像这样:

<Student id: 75, email: "laura81392@vilt.edu", 
  encrypted_password: "$2a$10$vdbbRPmAu/cZJy7jOPfXLI54KBMRZu5...", 
  reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil,
  sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, 
  current_sign_in_ip: nil, last_sign_in_ip: nil, profile_name: "lily", 
  first_name: "Laura", last_name: "Lil", how_did_you_hear: "Other", 
  created_at: "2014-08-29 16:22:16", updated_at: "2014-08-29 17:02:22", 
  type: "Student", school_id: 16, company: nil, title: nil, wants_mail: true,
  confirmation_token: "056b347e438a5b3b7011af29e6e6795d2cb090b47ff3d67f...", 
  confirmed_at: "2014-08-29 16:24:19", confirmation_sent_at: "2014-08-29 17:02:22",
  unconfirmed_email: "laura@ldog123.com">

我跑

User.find(75).confirm!

但它根本不会改变用户。该命令返回nil。用户根本不会改变。如何重新确认电子邮件?

1 个答案:

答案 0 :(得分:0)

来自documentation

如果您尝试跳过确认,请使用:

user = User.find(1)
user.email = "new_email@gmail.com"
user.skip_reconfirmation!
user.save