Skip to content

Instantly share code, notes, and snippets.

@rtomayko
Forked from anonymous/session.rb
Created January 28, 2009 02:29
Show Gist options
  • Select an option

  • Save rtomayko/53782 to your computer and use it in GitHub Desktop.

Select an option

Save rtomayko/53782 to your computer and use it in GitHub Desktop.
require 'sinatra'
enable :sessions
before do
if session['rand'].nil?
session['rand'] = rand(1000)
end
if session['object'].nil?
session['object'] = Object.new
end
end
get '/' do
session['foo'] ||= 'foo'
session['foo'] << 'o'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment