enable :sessions get '/foo' do session['m'] = 'Hello World!' redirect '/bar' end get '/bar' do session['m'] # => 'Hello World!' end
它似乎不起作用.
解决方法
你在用霰弹枪吗?如果是,请执行以下操作:
configure(:development) { set :session_secret,"something" }
在Sinatra 1.3中不再需要这样做.