我正在尝试使用 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
发布评论