![](/img/trans.png)
[英]ActionDispatch::Cookies::CookieOverflow but the cookie is small
[英]How to rescue_from ActionDispatch::Cookie::CookieOverflow?
首先,我读到:
这不是我要面对的问题。
我正在与:
gem "rails", "~> 3.2.11"
和
ruby 1.9.3-p125
我正在尝试处理搜索,当搜索太大时,出现此错误:
ActionDispatch::Cookies::CookieOverflow
我想在ApplicationController中抢救这个错误,但似乎对我不起作用:
rescue_from ActionDispatch::Cookies::CookieOverflow :with => :render_404
哪里:
def render_404
respond_to do |r|
r.html { render :template => "something/404", :status => 404}
r.all { render :nothing => true, :status => 404 }
end
true
end
任何帮助都会受到欢迎。
rescue_from ActionDispatch::Cookies::CookieOverflow :with => :render_404
根据文档,您在参数中缺少逗号(,)
使用correc语法
rescue_from ActionDispatch::Cookies::CookieOverflow, with: :render_404
rescue_from接收一系列异常类或类名,以及带有方法名的结尾:with选项
查看更多: http : //api.rubyonrails.org/v5.0/classes/ActiveSupport/Rescuable/ClassMethods.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.