session[:foo] size limit?

Hi there,

i want to store an array of filenames in a session-variable (session[:foo). The problem is: if it reaches a current number of entries the application breaks.

Is there a storage-limit of session-variables? Is it possible to extend it? Is there an alternative to store large strings/arrays?

Thanks 'till now Hans

Hi there,

i want to store an array of filenames in a session-variable (session[:foo). The problem is: if it reaches a current number of entries the application breaks.

Is there a storage-limit of session-variables? Is it possible to extend it? Is there an alternative to store large strings/arrays?

It depends on the session store you are using. The default is CookieStore, where the entire session is in the cookie, ie the maximum size of a session is 4k (minus some overhead). If you got for a database backed store then you're only limited by the database and how you have setup the sessions table. If you find yourself storing large amounts of data in the session you may want to consider an alternative design (such as storing the data in the database in a more direct form)

Fred

Do you mean something like storing the entries temporarly in a database with action:create and delete them when not needed anymore? ... I think thats pretty much confusing to store.

Isn't there a possability to many strings/arrays (checkbox_values) in a variable? How can I change the session storage?

Thank you very much for your suggestion.

Greets Hans

Do you mean something like storing the entries temporarly in a database with action:create and delete them when not needed anymore? ... I think thats pretty much confusing to store.

Isn't there a possability to many strings/arrays (checkbox_values) in a variable?

Well that variable has to live somewhere and you don't have a huge amount of choices in that regard.

How can I change the session storage?

With a rails app generated by a recent version of rails you'll have an initializer called something like session.rb or session_store.rb in config/initializers that sets up the session

Fred

With a rails app generated by a recent version of rails you'll have an initializer called something like session.rb or session_store.rb in config/initializers that sets up the session

I've got a rails app generated by a recent version of rails but no initializer caller session.rb ... not even an entry in other initializers. Can it be anywhere else?

Thanks Hans

> With a rails app generated by a recent version of rails you'll have an > initializer called something like session.rb or session_store.rb in > config/initializers that sets up the session

I've got a rails app generated by a recent version of rails but no initializer caller session.rb ... not even an entry in other initializers. Can it be anywhere else?

Previously that stuff was an environment.rb - I was just pointing that out as a template for how you set that stuff up .

Fred