lib/cuba_api/current_user.rb in cuba-api-0.3.0 vs lib/cuba_api/current_user.rb in cuba-api-0.3.1
- old
+ new
@@ -31,13 +31,13 @@
end
def current_user( user = nil )
if user
- session['user'] = self.class.sessions.to_session( user )
+ session[ 'user' ] = self.class.sessions.to_session( user )
@_current_user = user
- else
- @_current_user ||= self.class.sessions.from_session( session['user'] )
+ elsif env[ 'rack.session' ]
+ @_current_user ||= self.class.sessions.from_session( session[ 'user' ] )
end
end
def reset_current_user
session[ 'user' ] = nil