读书人

rails2.3.2 ExceptionNotifier 配备

发布时间: 2012-08-27 21:21:57 作者: rapoo

rails2.3.2 ExceptionNotifier 配置

必须先在项目中要加入plugin

?

rescue_from Exception do |exception|    pp exception    case exception      when "ActionController::NameError"      flash[:error] = exception.message.to_s      when "ActiveRecord::RecordNotFound"      flash[:error] = exception.message.to_s      when "ActionController::UnknownAction"      flash[:error] = exception.message.to_s.split(".")[0]  rescue  "No action responded to #{params[:action]}"      else      return rescue_action_in_public(exception)    end    redirect_to :controller => 'blog', :action => "list"  end

?哈哈,这样就大功告成了!!!

读书人网 >网络基础

热点推荐