rails 根据异常显示特定的错误页面
rescue_from 异常, :with => :action
eg:
rescue_from Exception, :with => :error
def error
render :file => "novel/infos/error", :layout => "novel"
end
当发生了指定的异常时,就会显示特定的页面,这个通常放到application_controller中
发布时间: 2012-12-27 10:17:10 作者: rapoo
rails 根据异常显示特定的错误页面
rescue_from 异常, :with => :action
eg:
rescue_from Exception, :with => :error
def error
render :file => "novel/infos/error", :layout => "novel"
end
当发生了指定的异常时,就会显示特定的页面,这个通常放到application_controller中