This must seem like a silly question to those of you in the know, but digging around http://api.rubyonrails.com/ doesnt get my anywhere. How do I retrieve a session based on it''s ID? I''d expect something like my_session = ActiveController::Sessions.find_by_id(session_id) But I can''t find anything even remotely similar to that in the API... Thanks, Tyler --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Tyler, Tyler MacDonald wrote,> This must seem like a silly question to those of you in the know, but > digging around http://api.rubyonrails.com/ doesnt get my anywhere. > > How do I retrieve a session based on it''s ID? I''d expect something like > > my_session = ActiveController::Sessions.find_by_id(session_id) > > But I can''t find anything even remotely similar to that in the API...That''s because, for the most part, you won''t ever need to do that. The Rails architecture protects you from having to figure out that crap. If you need to, for example, delete the current session, you just do session.destroy. If you need to access a session variable for the current session, you just do session[:variable_of_interest]. As you learn more about Rails, you''ll understand why that''s true. If you have some reason for doing more than that kind of stuff, you''ll need to say more about what it is you''re trying to do. Most often, though, folks new to Rails find things like this are just much easier than they''re used to. hth. Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Tyler, Are you looking to do something like this? session.session_id That will retrieve the unique session_id that''s generated. I''m assuming you''re using: config.action_controller.session_store = :active_record_store -Dave On 3/17/07, Tyler MacDonald <google.com-oTuY4Vk9bUDG8MNy1oJpyw@public.gmane.org> wrote:> > > This must seem like a silly question to those of you in the know, but > digging around http://api.rubyonrails.com/ doesnt get my anywhere. > > How do I retrieve a session based on it''s ID? I''d expect something like > > my_session = ActiveController::Sessions.find_by_id(session_id) > > But I can''t find anything even remotely similar to that in the API... > > Thanks, > Tyler > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bill Walton <bill.walton-xwVYE8SWAR3R7s880joybQ@public.gmane.org> wrote:> If you have some reason for doing more than that kind of stuff, you''ll > need to say more about what it is you''re trying to do.I have three uses for grabbing a session by ID right now, and I''m betting as I go along there will be more. :-) 1) AJAX instant messanging. When two people initiate an IM conversation, I would like the messages to be delivered by session ID. 2) PayPal. I would like the session that initiated a purchase to be indicated in the PayPal IPN. I can do that without actually looking up the session, but it would be nice to do something with the session (eg; set a flag) when the IPN comes in. Yes, I could set a flag on the "user", but what if somebody is making a purchase without creating an account? 3) Applets. These can''t/don''t always pass the browser''s cookies along. It''d be nice to point applets at a url with the session id embedded, and then work with that to figure out what user/session is using the applet. So all I really need, is some way to get from a Session ID to a session object. Thanks, Tyler --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Dave Hoefler <dhoefler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Are you looking to do something like this? > > session.session_id > > That will retrieve the unique session_id that''s generated. I''m assuming > you''re using: > config.action_controller.session_store = :active_record_storeI will be, but I would still like a way to get from session ID to session object without depending on active_record_store... that way I can turn this stuff into plugins, without them depending on a model. Thanks, Tyler --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---