Rails session ID

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 S.
[email protected]

Try request.session_options[:id]

On Tue, Aug 14, 2012 at 7:59 AM, Tim S. [email protected]
wrote:

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 :slight_smile:


Hassan S. ------------------------ [email protected]

twitter: @hassan

request.session_options[:id] should work in any controller.

tomkins [email protected] 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 S.
[email protected]

On 08/14/2012 09:59 AM, Tim S. wrote:

What do I need to do?
Session is a hash as the error states. So do session[‘session_id’].