使用 Resque 和 resque_mailer 发送电子邮件会引发路由错误 [英] Using Resque and resque_mailer to send emails raises Routing error

查看:27
本文介绍了使用 Resque 和 resque_mailer 发送电子邮件会引发路由错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Resque 和 resque_mailer gem 在 Rails 3 中使用后台作业发送电子邮件.不使用 Resque 时,电子邮件可以正常发送,但是当它们作为后台作业处理时,该作业无法引发 ActionView::Template::Error,我已将其追溯到我的链接我试图在电子邮件上打印.这是冲突的行:

I'm trying to send emails using a background job in Rails 3 using Resque and the resque_mailer gem. Emails are sent fine when not using Resque, but when they are processed as a background job, the job fails raising a ActionView::Template::Error which I've traced back to a link that I'm trying to print on the email. This is the conflicting line:

link_to t('.here'), topic_url(@comment.topic, :load_all => true, :anchor => "c#{@comment.id}")

即使尝试打印 root_url 也会引发类似的异常.

Even trying to print a root_url raises a similar exception.

有没有人知道为什么会失败?我几乎什么都试过了:(

Does anyone have any ideas as to why this is failing? I've tried almost everything :(

提前致谢!

推荐答案

确保不要将参数中的 ActiveRecord 对象发送到邮件程序方法.而是发送标识符并将它们加载到方法主体中.

Make sure you don't send ActiveRecord objects in the params to the mailer method. But rather send identifiers and load them in the method body.

这篇关于使用 Resque 和 resque_mailer 发送电子邮件会引发路由错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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