Devise - 在开发中跳过用户确认 [英] Devise - Skipping user confirmation in Development

查看:131
本文介绍了Devise - 在开发中跳过用户确认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发中如何跳过用户确认。

How do you skip user confirmation in development in devise.

我已经设置了使用SendGrid发送电子邮件的生产环境,但现在我已经做到了,不会让我登录。

I have set up the production environment to send emails with SendGrid, but now I have done that it won't let me log in.

感谢您的时间!

推荐答案

在控制台中创建用户:

user = User.create( 
  :first_name            => 'admin', 
  :last_name             => 'admin', 
  :email                 => 'foo...@email.com', 
  :password              => 'password1', 
  :password_confirmation => 'password1' 
).skip_confirmation! 
 # Devise :doc:
 # If you don't want confirmation to be sent on create, neither a code
 # to be generated, call skip_confirmation!

或在型号中:

 after_create :skip_conf!

  def skip_conf!
    self.confirm! if Rails.env.development?
  end

这篇关于Devise - 在开发中跳过用户确认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆