发生错误的时候发送email邮件提醒
1. 安装exception_notification:
- rubyscript/plugininstall http://dev.rubyonrails.org/svn/rails/plugins/exception_notification/
2. 在config/environment.rb文件里面添加这样一行设置接受错误邮件的邮箱:
ExceptionNotifier.exception_recipients=%w(your@emailaddress.com)
ExceptionNotifier.sender_address = %("Application Error" <web@emailaddress.com>)
3. 在application控制器中加入include ExceptionNotifiable
classApplicationController<ActionController::Base
includeExceptionNotifiable
end
4.说明:
只在production环境中有效