-->

Rails 4.1.6 session ID

2019-06-18 23:48发布

问题:

How to get session id from a request object. Below code can be used in Rails 3 to get the session ID. But this doesn't seem to be working any more in Rails 4.1.6 and Ruby 2.1.3

request.session_options[:id]

回答1:

session.id

This is the correct way to do it.