Last active
May 5, 2024 13:06
-
-
Save kalmbach/5385621 to your computer and use it in GitHub Desktop.
Revisions
-
kalmbach created this gist
Apr 15, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ module Rack module Session class Flash def initialize(app) @app = app end def call(env) dup.call!(env) end def call!(env) env['rack.session'] || raise(RuntimeError, 'You\'re missing a session handler. ' + 'You can get started using Rack::Session::Cookie') env['rack.session']['flash'] ||= {} response = @app.call(env) env['rack.session']['flash'].clear response end end end end