Skip to content

Instantly share code, notes, and snippets.

View johnknott's full-sized avatar
🎯
Focusing

John Knott johnknott

🎯
Focusing
View GitHub Profile
@johnknott
johnknott / gist:1052539
Created June 28, 2011 23:55 — forked from jnunemaker/gist:217362
example of warden with sinatra
Warden::Manager.serialize_into_session{|user| user.id }
Warden::Manager.serialize_from_session{|id| User.get(id) }
Warden::Manager.before_failure do |env,opts|
# Sinatra is very sensitive to the request method
# since authentication could fail on any type of method, we need
# to set it for the failure app so it is routed to the correct block
env['REQUEST_METHOD'] = "POST"
end