enable :sessions
get '/foo' do
session['m'] = 'Hello World!'
redirect '/bar'
end
get '/bar' do
session['m'] # => 'Hello World!'
end
It does not seem to work.
enable :sessions
get '/foo' do
session['m'] = 'Hello World!'
redirect '/bar'
end
get '/bar' do
session['m'] # => 'Hello World!'
end
It does not seem to work.
Are you using shotgun? If so, do the following:
This will no longer be necessary in Sinatra 1.3.
Perhaps you have cookies disabled on your web browser? Sinatra's sessions use cookies by default.
Here's my test app:
And here it is in action:
Without cookies, your redirect will work but it will be as though it's a brand new session after the redirect, with the session starting from scratch.