I''m trying to retrieve the session ID in rails. I found a web page that said to use session.session_id But when I do that, I get: undefined method `session_id'' for #<Rack::Session::Abstract::SessionHash:0x2e14c5> What do I need to do? -- Tim Slattery Slattery_T-R43zzhgHTig@public.gmane.org -- 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 https://groups.google.com/groups/opt_out.
On 08/14/2012 09:59 AM, Tim Slattery wrote:> I''m trying to retrieve the session ID in rails. I found a web page > that said to use > > session.session_id > > But when I do that, I get: > > undefined method `session_id'' for > #<Rack::Session::Abstract::SessionHash:0x2e14c5> > > What do I need to do?Session is a hash as the error states. So do session[''session_id'']. -- 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 https://groups.google.com/groups/opt_out.
Try request.session_options[:id] -- 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 To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/gIAIeyQI27wJ. For more options, visit https://groups.google.com/groups/opt_out.
On Tue, Aug 14, 2012 at 7:59 AM, Tim Slattery <Slattery_T-R43zzhgHTig@public.gmane.org> wrote:> I''m trying to retrieve the session ID in rails. I found a web page > that said to use > > session.session_id > > But when I do that, I get: > > undefined method `session_id'' for > #<Rack::Session::Abstract::SessionHash:0x2e14c5> > > What do I need to do?Show the code that''s causing that error message, plus the versions of both Ruby and Rails. At least for starters :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- 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 https://groups.google.com/groups/opt_out.
request.session_options[:id] should work in any controller. On Tuesday, August 14, 2012 3:59:15 PM UTC+1, Tim Slattery wrote:> > I''m trying to retrieve the session ID in rails. I found a web page > that said to use > > session.session_id > > But when I do that, I get: > > undefined method `session_id'' for > #<Rack::Session::Abstract::SessionHash:0x2e14c5> > > What do I need to do? > > -- > Tim Slattery > Slatt...-R43zzhgHTig@public.gmane.org <javascript:> > >-- 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 To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/PPYOut0d6lIJ. For more options, visit https://groups.google.com/groups/opt_out.
tomkins <j.tomkins-EMRzualFZlQ@public.gmane.org> wrote:>Try request.session_options[:id]Thanks to all who replied. The code above worked. No doubt some of the other suggestions would have also. Many thanks from someone trying to figure out Ruby and Rails at the same time! -- Tim Slattery Slattery_T-R43zzhgHTig@public.gmane.org -- 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 https://groups.google.com/groups/opt_out.