I am logging web visits with a before_filter on the application controller. The issue I''m having is that the initial visit does not return a session id. I''m using the SqlSessionStore and the function MysqlSession.find_session(session.session_id) to retrieve the session id. If it doesn''t exist I use a -1. So looking in my visits table the initial visit always has -1 for the session id and the rest of the visits contain a valid session id for that visitor. I tried putting the logging of visits in the after filter but that didn''t seem to work. Is this something that I can correct or is that just the way it is with sessions? Thanks, Gunner --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
It makes sense that the initial visit would not have a session id because depending on where you are assigning it, you might be logging the variable before setting it. Also, you don''t really need to hang on to the session details when logging web visits. Unless you have a special reason to, i wouldn''t track any of the session details, they can easily be crated and compromised by scripts anyway. Try to keep session data to a minimum. You might need to show some code if this doesn''t help. Kent gwgeller wrote:> I am logging web visits with a before_filter on the application > controller. The issue I''m having is that the initial visit does not > return a session id. I''m using the SqlSessionStore and the function > MysqlSession.find_session(session.session_id) to retrieve the session > id. If it doesn''t exist I use a -1. So looking in my visits table the > initial visit always has -1 for the session id and the rest of the > visits contain a valid session id for that visitor. > > I tried putting the logging of visits in the after filter but that > didn''t seem to work. Is this something that I can correct or is that > just the way it is with sessions? > > Thanks, > Gunner-- 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 -~----------~----~----~----~------~----~------~--~---
Kent, I guess I really haven''t thought it through, but my original purpose was to group a visit using the session id as opposed to an ip which could potentially be the same for two visitors. You mentioned where I set the session id, but I don''t do it, SqlSessionStore does it for me, but I''m curious has to how that works. Do you know when the session would be set? On Oct 22, 10:25 am, Kent Fenwick <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> It makes sense that the initial visit would not have a session id > because depending on where you are assigning it, you might be logging > the variable before setting it. > > Also, you don''t really need to hang on to the session details when > logging web visits. Unless you have a special reason to, i wouldn''t > track any of the session details, they can easily be crated and > compromised by scripts anyway. Try to keep session data to a minimum. > > You might need to show some code if this doesn''t help. > > Kent > > gwgeller wrote: > > I am logging web visits with a before_filter on the application > > controller. The issue I''m having is that the initial visit does not > > return a session id. I''m using the SqlSessionStore and the function > > MysqlSession.find_session(session.session_id) to retrieve the session > > id. If it doesn''t exist I use a -1. So looking in my visits table the > > initial visit always has -1 for the session id and the rest of the > > visits contain a valid session id for that visitor. > > > I tried putting the logging of visits in the after filter but that > > didn''t seem to work. Is this something that I can correct or is that > > just the way it is with sessions? > > > Thanks, > > Gunner > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---