I am using the default Cookie-Based Session in Rails 2.0. I have accumulated the bad practice of adding: session[''seen_announcement_'' + Date.today.to_s] = true over the years. No users have complained yet, but I am assuming that each user must have hundreds of seen_announcement_XXXXX in their cookies I would like to write a script to clean their sessions of those keys. Yet, I am finding the following: 1) session is not Hash. I cannot use session.keys to list all the keys in session. How would I do this? I would like to dump out a session then sort through the keys and delete the proper ones. 2) session.delete actually deletes the entire session. There is no method for deleting each key in a session. Please help me on out this. On the other hand, how does this work. Do all session variables get submitted along with HTTP request each time a user loads a page? So this means the more I store in session the slower a request takes? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 19 Mar 2008, at 05:39, Sharkie Landshark wrote:> > I am using the default Cookie-Based Session in Rails 2.0. > > I have accumulated the bad practice of adding: > > session[''seen_announcement_'' + Date.today.to_s] = true > > over the years. > > No users have complained yet, but I am assuming that each user must > have > hundreds of seen_announcement_XXXXX in their cookies > > I would like to write a script to clean their sessions of those keys. > Yet, I am finding the following: > > 1) session is not Hash. I cannot use session.keys to list all the keys > in session. How would I do this? I would like to dump out a session > then > sort through the keys and delete the proper ones. > > 2) session.delete actually deletes the entire session. There is no > method for deleting each key in a session. > > Please help me on out this. > > On the other hand, how does this work. Do all session variables get > submitted along with HTTP request each time a user loads a page? So > this > means the more I store in session the slower a request takes?With the cookie store, yes. Each response and request. Furthermore, if your cookie goes over maximum recommended sizes (i forget exactly how much) the browser is free to just ignore it. 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > -~----------~----~----~----~------~----~------~--~--- >
So now that I have put a lot of variables in a user''s cookie, how can I go about removing them? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sharkie Landshark wrote:> So now that I have put a lot of variables in a user''s cookie, how can I > go about removing them?I will even settle for the process of cleaning up an entire session removing up its data from cookies and starting from stcratch -- doing this from Rails and not by requiring my users to delete cookies from browser. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 20 Mar 2008, at 09:24, Sharkie Landshark wrote:> > Sharkie Landshark wrote: >> So now that I have put a lot of variables in a user''s cookie, how >> can I >> go about removing them? > > I will even settle for the process of cleaning up an entire session > removing up its data from cookies and starting from stcratch -- doing > this from Rails and not by requiring my users to delete cookies from > browser.If you change the secret used by the cookie store that will invalidate all the sessions (you will get a bunch of exceptions as rails will think the cookies were tampered with though). 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---