0

Im trying to save a array in a session which is much bigger than 4 KB.

In this case the: ActionDispatch::Cookies::CookieOverflow Error occures.

Does anybody have a hint how to save a bigger array in a session? Saving it to the db is not what I want.

Thanks, Markus

Markus
  • 3,948
  • 8
  • 48
  • 64
  • you have to change your session store , why you cant use ActiveRecord store? . – andrea Jan 24 '11 at 13:55
  • possible duplicate of [Cookie overflow in rails application?](http://stackoverflow.com/questions/9473808/cookie-overflow-in-rails-application) – Mike Szyndel Aug 31 '13 at 14:51

1 Answers1

6

You need change your session_store and don't use the cookie_store. You can use the active_record_store by example.

shingara
  • 46,608
  • 11
  • 99
  • 105
  • Thanks for your answer, Im not sure how to change that store... my second question is if active_record_store is better for a big amount of data and a lot of different users? – Markus Jan 24 '11 at 15:38
  • I tried to use: config.session_store(:active_record_store) in the application.rb file, but it didn't help so far... – Markus Jan 24 '11 at 15:50
  • Have you add and launch the migration too ? – shingara Jan 25 '11 at 08:41
  • @Markus See my answer (http://stackoverflow.com/questions/9473808/cookie-overflow-in-rails-application) May be this one is helping you – AMIC MING Feb 28 '12 at 17:58
  • what if I don't want to store anything in the DB how I can rescue the error? I tried rescue_from ActionDispatch::Cookies::CookieOverflow, :with => :render_404 in the ApplicationController but it didn't work – nisevi Jul 17 '15 at 22:03