这源于一封在 Heroku 上使用 resque 调度程序发送的电子邮件。
为了解决我的错误:
NoMethodError: undefined method `name' for nil:NilClass
我删除了电子邮件的所有内容,并将我的邮件合并为如下所示:
def immediate_topic(enterprise_member, topic)
mail :to => 'email@land_of_emails.com',
:from => 'other_email@land_of_emails.com',
:date => DateTime.now,
:subject => "Subject"
end
提交代码,部署,然后同样的错误!:
NoMethodError: undefined method `name' for nil:NilClass
我猜可能 resque 或 resque 调度程序在我部署时实际上并没有重新启动。
有人对我如何调试这个有任何想法吗?
全部积压
app/mailers/notification_mailer.rb:20:in `immediate_topic'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8.rc2/lib/abstract_controller/base.rb:167:in `process_action'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8.rc2/lib/abstract_controller/base.rb:121:in `process'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8.rc2/lib/abstract_controller/rendering.rb:45:in `process'
vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.8.rc2/lib/action_mailer/base.rb:457:in `process'
vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.8.rc2/lib/action_mailer/base.rb:452:in `initialize'
vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.8.rc2/lib/action_mailer/base.rb:439:in `new'
vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.8.rc2/lib/action_mailer/base.rb:439:in `method_missing'
app/jobs/send_emails.rb:35:in `block (2 levels) in notify!'
app/jobs/send_emails.rb:34:in `each'
app/jobs/send_emails.rb:34:in `block in notify!'
app/jobs/send_emails.rb:33:in `each'
app/jobs/send_emails.rb:33:in `notify!'
app/jobs/send_emails.rb:11:in `block in perform'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8.rc2/lib/active_record/relation/delegation.rb:6:in `each'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8.rc2/lib/active_record/relation/delegation.rb:6:in `each'
app/jobs/send_emails.rb:7:in `perform'
app/jobs/whisper_job.rb:29:in `perform'
app/jobs/whisper_job.rb:10:in `block in define_task'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'