Browse files

Support lazily loaded sessions

  • Loading branch information...
1 parent 071025c commit 736aa566440e0b0b2a75de1be75d0fa64147cb4b @josevalim josevalim committed Jul 14, 2013
Showing with 10 additions and 3 deletions.
  1. +3 −0 History.rdoc
  2. +7 −3 lib/warden/session_serializer.rb
View
3 History.rdoc
@@ -1,3 +1,6 @@
+== Version 1.2.3 / 2013-07-14
+* Fix an issue with lazy loaded sessions
+
== Version 1.2.2 / 2013-07-12
* Support nil session stores on logout
* Fix strategies blowing up with undefined method base
View
10 lib/warden/session_serializer.rb
@@ -1,11 +1,10 @@
# encoding: utf-8
module Warden
class SessionSerializer
- attr_reader :env, :session
+ attr_reader :env
- def initialize(env, session=env['rack.session'])
+ def initialize(env)
@env = env
- @session = session || {}
end
def key_for(scope)
@@ -44,5 +43,10 @@ def stored?(scope)
def delete(scope, user=nil)
session.delete(key_for(scope))
end
+
+ # We can't cache this result because the session can be lazy loaded
+ def session
+ env["rack.session"] || {}
+ end
end # SessionSerializer
end # Warden

0 comments on commit 736aa56

Please sign in to comment.