首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

rails 根据错误显示特定的异常页面

2012-12-27 
rails 根据异常显示特定的错误页面rescue_from异常, :with :actioneg:rescue_from Exception, :with

rails 根据异常显示特定的错误页面
rescue_from  异常, :with => :action

eg:
rescue_from Exception, :with => :error

def error
  render :file => "novel/infos/error", :layout => "novel"
end

当发生了指定的异常时,就会显示特定的页面,这个通常放到application_controller中

热点排行