Rails Devise:after_confirmation [英] Rails Devise: after_confirmation

查看:115
本文介绍了Rails Devise:after_confirmation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法创建一个 after_confirmation:do_something

目标是发送电子邮件,用户确认使用Devise 后的邮件:confirmable

The goal is to send an e-mail after the user confirms using Devise :confirmable.

推荐答案

我没有看到回调,但您应该能够在用户上使用一个before_save回调(使用观察者的额外信用),并检查confirm_at是否刚刚由devise设置。您可以执行以下操作:

Hmm, I don't see a callback for that, but you should be able to put a before_save callback on the user (extra credit for using an observer) and check if confirmed_at was just set by devise. You can do something like:

  send_the_email if self.confirmed_at_changed?

http://api.rubyonrails.org/classes/ActiveModel/Dirty.html ,了解有关检查字段更改的详细信息。

http://api.rubyonrails.org/classes/ActiveModel/Dirty.html for more details on checking the change on the field.

这篇关于Rails Devise:after_confirmation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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