- Session is just a Hash in ruby.
To use session , you need to configure your sinatra to enable session. You could set a secret to the session.
configure do
enable :sessions
set :session_secret, "password"
end
Initially, we have three keys in the Session hash, ie
1. session_id
2. csrf
3. tracking
But you could add any additional key/value pairs into the Session hash.
- Session is stored as cookies in the web browsers.
Session can persist across different sinatra route. ie : the session data in http://app.com/first and http://app.com/second is the same
To use session , you need to configure your sinatra to enable session. You could set a secret to the session.
configure do
enable :sessions
set :session_secret, "password"
end
Initially, we have three keys in the Session hash, ie
1. session_id
2. csrf
3. tracking
But you could add any additional key/value pairs into the Session hash.
- Session is stored as cookies in the web browsers.
Session can persist across different sinatra route. ie : the session data in http://app.com/first and http://app.com/second is the same
Comments
Post a Comment