1

First at all, I have read:

Cookie overflow in rails application?

And this is not the problem that I'm facing.

I'm working with:

gem "rails", "~> 3.2.11"

and

ruby 1.9.3-p125

I'm trying to process a search, and when the search is tooooooo big I get this error:

ActionDispatch::Cookies::CookieOverflow

I would like to rescue_form this error in the ApplicationController but it seems that is not working for me:

rescue_from ActionDispatch::Cookies::CookieOverflow :with => :render_404

where:

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

any help is going to be well received.

Community
  • 1
  • 1
nisevi
  • 627
  • 1
  • 10
  • 27
  • I have the same question. The other answers are idiotic - just because you have an issue doesn't mean abandoning the massive advantages of cookie store. Need a method to debug cookie sizes, see exactly what is happening, etc – Kevin Aug 15 '15 at 17:37
  • The short answer seems to be - this is a rails bug - it should be possible to rescue this error, and it's quite crazy that it returns an error without giving you any way to rescue, log, or otherwise even KNOW an error is occuring. – Kevin Aug 15 '15 at 17:46

1 Answers1

0

rescue_from ActionDispatch::Cookies::CookieOverflow :with => :render_404

you are missing comma (,) in arguments , according to docs

with correc syntax

rescue_from ActionDispatch::Cookies::CookieOverflow, with: :render_404

rescue_from receives a series of exception classes or class names, and a trailing :with option with the name of a method

see more: http://api.rubyonrails.org/v5.0/classes/ActiveSupport/Rescuable/ClassMethods.html

Alok Yadav
  • 159
  • 1
  • 7