ITeye博客

rails 3.0 异常处理

mike.gao · 2010-12-15 16:44 · rails3 · 编程语言 · HTML · Java · Rails · Markdown

in your application.rb


ActionController::Base
  rescue_from ActionController::RoutingError, :with => :render_404

  private
  def render_404(exception = nil)
    if exception
        logger.info "Rendering 404: #{exception.message}"
    end

    render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false
  end

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。