rails 根据异常显示特定的错误页面
程序员文章站
2022-07-15 20:04:14
...
rescue_from 异常, :with => :action
eg:
rescue_from Exception, :with => :error
def error
render :file => "novel/infos/error", :layout => "novel"
end
当发生了指定的异常时,就会显示特定的页面,这个通常放到application_controller中
eg:
rescue_from Exception, :with => :error
def error
render :file => "novel/infos/error", :layout => "novel"
end
当发生了指定的异常时,就会显示特定的页面,这个通常放到application_controller中
上一篇: has_many 关联关系表单 提交
下一篇: 同时分页查找没有关联关系的多个表
推荐阅读