使用 Resque 和 resque

编程入门 行业动态 更新时间:2024-10-26 14:31:22
本文介绍了使用 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

本文发布于:2023-10-16 05:18:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1496613.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Resque   resque

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!