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?

Session is a hash as the error states. So do session['session_id'].

Try request.session_options[:id]

Show the code that's causing that error message, plus the versions of both Ruby and Rails. At least for starters :slight_smile:

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!