Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding the session id in rails 3

How can I get the current session id in rails 3?

I've tried the following with no luck:

session[:session_id] session['session_id'] session[:id] session['id'] session.id session.session_id 
like image 300
Austin Avatar asked Jan 28 '11 04:01

Austin


People also ask

What is Session ID Rails?

A session id consists of the hash value of a random string. The random string is the current time, a random number between 0 and 1, the process id number of the Ruby interpreter (also basically a random number) and a constant string. Currently it is not feasible to brute-force Rails' session ids.

Where are sessions stored in Rails?

Rails store it in server side. Session is saved in server side like key value pair (like json object)

What is Session ID value?

The SessionID property is used to uniquely identify a browser with session data on the server. The SessionID value is randomly generated by ASP.NET and stored in a non-expiring session cookie in the browser. The SessionID value is then sent in a cookie with each request to the ASP.NET application.


2 Answers

It also returns the session ID:

session[:session_id] 
like image 26
whatbird Avatar answered Oct 04 '22 21:10

whatbird


Have you tried the following?

request.session_options[:id] 
like image 198
splicer Avatar answered Oct 04 '22 20:10

splicer