Javier
(Javier)
December 24, 2007, 12:58pm
1
Hi, Im developing an application in Rails 2.02.
Everything seems to work fine but the problems begin when I try to put
some data in the session.
I have a model in proyect/models:
class Result
attr_accessor :names, :urls, :images
def initialize
@names = Array.new
@urls = Array.new
@images = Array.new
end
end
Controller:
@variable = Result.new
#code that fills up the values in the result arrays.
session[:result] = @result
I fill these attributes from a controller. At the end, if I try to put
the variable into the session I get the msg:
Status: 500 Internal Server Error Content-Type: text/html
500 Internal Server Error
Any ideas? thanks!
Hi, Im developing an application in Rails 2.02.
Everything seems to work fine but the problems begin when I try to put
some data in the session.
I have a model in proyect/models:
class Result
attr_accessor :names, :urls, :images
def initialize
@names = Array.new
@urls = Array.new
@images = Array.new
end
end
Controller:
@variable = Result.new
#code that fills up the values in the result arrays.
session[:result] = @result
I fill these attributes from a controller. At the end, if I try to put
the variable into the session I get the msg:
There should be a full stack trace in your log files.
Are you putting anything unserializable in your session?
Fred
Javier
(Javier)
December 24, 2007, 1:20pm
3
This is the trace of the log
Rendering /Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/
action_controller/templates/rescues/layout.erb (internal_server_error)
/!\ FAILSAFE /!\ Mon Dec 24 14:19:02 +0100 2007
Status: 500 Internal Server Error
CGI::Session::CookieStore::CookieOverflow
/Library/Ruby/Gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
session/cookie_store.rb:112:in `close'
Is it too big what I'm trying to store in the session?
fxn
(Xavier Noria)
December 24, 2007, 1:26pm
4
In your snippet there's this comment:
#code that fills up the values in the result arrays.
I guess the resulting cookie value after you populate the inner arrays (think whole object tree marshalled + Base64 encoding + two dashes + digest) is > 4K.
Do you really need such an object in the session. If yes then you'd need to switch to a different storage.
-- fxn
Javier
(Javier)
December 24, 2007, 1:48pm
5
Thanks. I didn't know that you could only store 4Kb in size in the
session. I guess that I will use a database to store it then.
Thanks for your fast reply!