【发布时间】:2013-02-25 16:26:01
【问题描述】:
我想将 exception_notification gem 添加到我们的应用程序中,但是,当我尝试手动触发邮件时会发生这种情况:
exception
# => #<ZeroDivisionError: divided by 0>
ExceptionNotifier::Notifier.exception_notification(request.env, exception)
# => #<ActionMailer::Base::NullMail:0x007fa81bc7c610>
ExceptionNotifier::Notifier.background_exception_notification(exception)
# => #<ActionMailer::Base::NullMail:0x007fa81bf58190>
在上面的示例中,控制台位于 ApplicationController 中的 rescue_from Exception 内的断点处,之后是某个控制器中故意的 1/0。
我也在使用delayed_job,但是 - 不足为奇 - ExceptionNotifier::Notifier.background_exception_notification(exception).deliver 没有假脱机。
我已经在开发中设置了config.consider_all_requests_local = false,但仍然 exception_notification 实例化 NullMail。在应用程序的其他部分,邮件可以正常工作并使用sendmail。
有什么想法我在这里做错了吗?感谢您的帮助!
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 exception-notification exception-notifier