Permalink
Browse files

Stop the flash middleware from forcibly loading sessions even if the …

…user doesn't use sessions at all
  • Loading branch information...
1 parent a260e02 commit cb1b2a719ac2ba31dc8d66195c0be32798255be0 @wycats wycats committed Jun 4, 2010
@@ -170,13 +170,13 @@ def initialize(app)
end
def call(env)
- if (session = env['rack.session']) && (flash = session['flash'])
+ if (session = env['rack.session']) && session.key?('flash')
flash.sweep
end
@app.call(env)
ensure
- if (session = env['rack.session']) && (flash = session['flash']) && flash.empty?
+ if (session = env['rack.session']) && session.key?('flash') && session['flash'].empty?
session.delete('flash')
end
end
@@ -51,11 +51,11 @@ def inspect
super
end
- private
- def loaded?
- @loaded
- end
+ def loaded?
+ @loaded
+ end
+ private
def load!
stale_session_check! do
id, session = @by.send(:load_session, @env)

1 comment on commit cb1b2a7

quasor commented on cb1b2a7 Jun 5, 2010

With this change flashes don't clear anymore...

Please sign in to comment.