Changing the session store in Rails 2.0

By Scott Roth on January 8th, 2008

Tagged with: rails, rails 2.x, sessions, configuration

We just converted one of our apps to Rails 2.0.2 today.  When testing the conversion, I got the application's login page but then a CookieOverflow error immediately after that.  Ok, that is easy enough to fix.  Cookies have a 4k limit and we, in a part of the app that we have long known could use some refactoring, store some data which causes sessions to occasionally grow over that limit.

To get things working again, all I needed to do is configure Rails to use the old default, the PStore.  For future reference, here is the configuration setting that goes into environment.rb:

1  config.action_controller.session_store = :p_store

Now all I have to do is bump the session handling refactoring up the priority list so that we can use the CookieStore in our next application release :)

Comments

Weigh in

(HTML tags are stripped, URLs are automatically converted to links)