Rails + Devise + delayed_job? [英] Rails + Devise + delayed_job?

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

问题描述

我有一个Rails 3应用程序使用Devise在Heroku。问题是我发送邮件与Sendgrid和电子邮件传递缓慢,它使应用程序挂起。所以我有兴趣使用delayed_job在后台排队电子邮件,所以我的应用程序响应用户。



如何将Devise与delayed_job一起使用?任何方式设置Devise使用delayed_job?

解决方案

从Robert May: https://gist.github.com/659514



将其添加到 config /初始化器目录:

 模块设计
模块模型
模块可确认
handle_asynchronously:send_confirmation_instructions
end

module可恢复
handle_asynchronously:send_reset_password_instructions
end

module可锁定
handle_asynchronously:send_unlock_instructions
end
end
end


I have a Rails 3 App using Devise on Heroku. Problem is I'm sending emails with Sendgrid and email delivery is slow, it makes the app hang. So I'm interested in using delayed_job to queue the email delivery in the background so my app is responsive to the user.

How can Devise be used with delayed_job? Any way to setup Devise to use delayed_job?

解决方案

From Robert May: https://gist.github.com/659514

Add this to a file in config/initializers directory:

module Devise
  module Models
    module Confirmable
      handle_asynchronously :send_confirmation_instructions
    end

    module Recoverable
      handle_asynchronously :send_reset_password_instructions
    end

    module Lockable
      handle_asynchronously :send_unlock_instructions
    end
  end
end

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

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