Hi,
There doesn't seem to be any previous posts about this problem, I must
be
setting things up wrongly at very basics...
Firstly, the problem... I can't get session to persist with
active_record_store. I enabled (config.action_controller.session_store =
:active_record_store) in environment.rb and created the sessions table
at my MySQL database. When I do a session[:blah] = "blah" at the
controller, it does save it (encrypted/scrambled) in the DB, but it
doesn't persist in the session hash when I attempt to retrieve
session[:blah] later on.
I believe Rails/Rack somehow believes all my sessions are coming from a
different browser, does anyone have any clue?
I tried to use memcache store and dalli store as well, they failed at
"key too long" problem at the page load time, which also doesn't have
any previous posts on these forums... So I gave that up and am trying to
solve the above active_record issue as I need to move away from my
current Cookie based session store. I am at Rails 2.3.8.
Hi,
There doesn't seem to be any previous posts about this problem, I must
be
setting things up wrongly at very basics...
Firstly, the problem... I can't get session to persist with
active_record_store. I enabled (config.action_controller.session_store =
:active_record_store) in environment.rb and created the sessions table
at my MySQL database. When I do a session[:blah] = "blah" at the
controller, it does save it (encrypted/scrambled) in the DB, but it
doesn't persist in the session hash when I attempt to retrieve
session[:blah] later on.
I believe Rails/Rack somehow believes all my sessions are coming from a
different browser, does anyone have any clue?
I tried to use memcache store and dalli store as well, they failed at
"key too long" problem at the page load time, which also doesn't have
any previous posts on these forums... So I gave that up and am trying to
solve the above active_record issue as I need to move away from my
current Cookie based session store. I am at Rails 2.3.8.
Did you clear your browser's cookies at the point that you switched
from cookie store to activerecord store?
Yes, I cleared my session's cookie before my page loaded. I also cleared
the sessions at DB, just so there is no clash.
I agree it has something to do with what is being stored in the cookies.
Every time the page loads, it comes with cookies[:my_session_id] =
"BAh7CToPc2Vzc2lvbl9pZCIlYjE2OT..." of 4054 bytes long! Not sure what is
being stored there and what part of my app writes it... Understanding
that will at least solve one part of the problem.
Fred,
I think you were right; I discovered that clearing cookies from Rails is
not same as clearing it from the browser. It removed the chunky data in
cookies once I cleared Firefox's cookies, which solves the
active_session_store issue.
I think this will also solve the "key too long" issue with dalli...