我在Heroku上有一个使用Devise的Rails 3应用程序。问题是我正在使用Sendgrid发送电子邮件,并且电子邮件传递速度很慢,这使应用程序挂起。因此,我对使用delay_job在后台将电子邮件传递进行排队感兴趣,因此我的应用程序可以响应用户。
Devise如何与delay_job一起使用?有什么方法可以设置Devise以使用delay_job?
最佳答案
从罗伯特·梅(Robert May):https://gist.github.com/659514
将此添加到config/initializers
目录中的文件中:
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
关于ruby-on-rails - Rails + Devise +延迟工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4125564/