国产一区二区精品久久_蜜桃狠狠狠狠狠狠狠狠狠_午夜视频精品_激情都市一区二区

當前位置:首頁 > 網站舊欄目 > 學習園地 > 設計軟件教程 > 每天一劑Rails良藥之Getting Notified of Unhandled Exceptions

每天一劑Rails良藥之Getting Notified of Unhandled Exceptions
2010-01-14 07:11:38  作者:  來源:
今天看看一個Exception Notificatio插件:
Java代碼 復制代碼
  1. ruby script/plugin install exception_notification  

然后我們在ApplicationController里添加如下代碼:
Java代碼 復制代碼
  1. include ExceptionNotifiable  

并且在config/environment.rb里配置Email:
Java代碼 復制代碼
  1. ExceptionNotifier.exception_recipients = %w(you@yourdomain.com)   
  2. ExceptionNotifier.sender_address = %("Application Error" <notifier@yourdomain.com>)   
  3. ExceptionNotifier.email_prefix = "[Your Application Name]"  

這樣當頁面出錯時就會以Email形式發送給recipients

安徽新華電腦學校專業職業規劃師為你提供更多幫助【在線咨詢