【发布时间】:2011-05-17 21:34:07
【问题描述】:
我正在运行 2.1.1、Rails 3,并且有很长时间才能让 delay_job gem 正常工作。如果我在邮件程序上删除 handle_asynchronously,一切正常......但如果我把它放回去,我会得到:
nil:NilClass 的未定义方法 `name'(其中 'name' 来自 @contact.name ...在禁用 handle_asynchronously 时可以正常工作)。
如果我去掉所有@contact 模板信息,我会得到:
“发送消息所需的发件人(返回路径、发件人或发件人)”?
这是我做错了什么还是某种错误?相关代码如下(my@email.here 替换为合法邮箱地址)
class ContactMailer < ActionMailer::Base
default :from => "my@email.here"
def contact_mail(contact)
@contact = contact
mail(:to => ENV['MANAGER_EMAIL'], :subject => 'Delayed Job Test', :from => 'my@email.here', :content_type => 'text/plain')
end
handle_asynchronously :contact_mail, :run_at => Proc.new { 2.seconds.from_now }
end
非常感谢任何建议。
【问题讨论】: