今天看看一个Exception Notificatio插件:
[code]
ruby script/plugin install exception_notification
[/code]
然后我们在ApplicationController里添加如下代码:
[code]
include ExceptionNotifiable
[/code]
并且在config/environment.rb里配置Email:
[code]
ExceptionNotifier.exception_recipients = %w(you@yourdomain.com)
ExceptionNotifier.sender_address = %("Application Error" <notifier@yourdomain.com>)
ExceptionNotifier.email_prefix = "[Your Application Name]"
[/code]
这样当页面出错时就会以Email形式发送给recipients
[code]
ruby script/plugin install exception_notification
[/code]
然后我们在ApplicationController里添加如下代码:
[code]
include ExceptionNotifiable
[/code]
并且在config/environment.rb里配置Email:
[code]
ExceptionNotifier.exception_recipients = %w(you@yourdomain.com)
ExceptionNotifier.sender_address = %("Application Error" <notifier@yourdomain.com>)
ExceptionNotifier.email_prefix = "[Your Application Name]"
[/code]
这样当页面出错时就会以Email形式发送给recipients