Deleting the current session with Rack::Session::Cookie

ecoffey picture ecoffey · Nov 23, 2010 · Viewed 12.9k times · Source

I feel like I'm missing something obvious here, and I'm hoping that as soon as I post this someone will shame me with the google search link I was missing :-)

enable :sessions

get '/logout' do
  # What goes here to kill the session?
end

Answer

Jonas Fagundes picture Jonas Fagundes · Dec 30, 2010

Just use

session.clear

to destroy the session.