Permalink
Browse files

Revert "Avoid uneeded queries in session stores if sid is not given."

First step to merge Rails and Rack session stores. Rack always expects to receive the SID since it may have different behavior if the SID is nil.

This reverts commit e210895.
  • Loading branch information...
1 parent d69949e commit 0f0bdaea7bf46c316ee63a9a66c8668354f142f2 @josevalim josevalim committed Jul 29, 2010
View
7 actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
@@ -191,11 +191,8 @@ def set_cookie(request, options)
def load_session(env)
stale_session_check! do
- if sid = current_session_id(env)
- sid, session = get_session(env, sid)
- else
- sid, session = generate_sid, {}
- end
+ sid = current_session_id(env)
+ sid, session = get_session(env, sid)
[sid, session]
end
end
View
1 actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
@@ -25,6 +25,7 @@ def initialize(app, options = {})
private
def get_session(env, sid)
+ sid ||= generate_sid
begin
session = @pool.get(sid) || {}
rescue MemCache::MemCacheError, Errno::ECONNREFUSED
View
1 activerecord/lib/active_record/session_store.rb
@@ -293,6 +293,7 @@ def destroy
private
def get_session(env, sid)
Base.silence do
+ sid ||= generate_sid
session = find_session(sid)
env[SESSION_RECORD_KEY] = session
[sid, session.data]

0 comments on commit 0f0bdae

Please sign in to comment.