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. Thanks for any insights, -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Nov 29, 12:02 am, "Mustafa C." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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? Fred> Thanks for any insights, > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. Frederick Cheung wrote in post #964655:> On Nov 29, 12:02am, "Mustafa C." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> doesn''t persist in the session hash when I attempt to retrieve >> > Did you clear your browser''s cookies at the point that you switched > from cookie store to activerecord store? > > Fred-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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... Cheers> Frederick Cheung wrote in post #964655: >> On Nov 29, 12:02am, "Mustafa C." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >>> doesn''t persist in the session hash when I attempt to retrieve >>> >> Did you clear your browser''s cookies at the point that you switched >> from cookie store to activerecord store? >> >> Fred-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Apparently Analagous Threads
- active_record_store sessions does not pass a :secret to #protect_from_forgery in Rails 2.0.0 Preview
- Switching to active_record_store session management errors out
- config.action_controller.session_store = :active_record_store
- Switching to ActiveRecord Session Store
- what is a session stored via the active_record_store option unique to?