diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-05-17 14:42:36 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-05-17 14:42:36 -0500 |
commit | 01d7acd11d631d980497870aad1af42a0c66115c (patch) | |
tree | 202cabbb2f650ad97685227da13023f660d79d4e /activerecord/lib | |
parent | b33c0d98329b97f8f540ba455d419d5046e6bb39 (diff) | |
download | rails-01d7acd11d631d980497870aad1af42a0c66115c.tar.gz rails-01d7acd11d631d980497870aad1af42a0c66115c.tar.bz2 rails-01d7acd11d631d980497870aad1af42a0c66115c.zip |
Fix reset_session with ActiveRecord store [#2200 state:resolved]
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/session_store.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index 21471da419..9dda3361d8 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -295,7 +295,7 @@ module ActiveRecord def set_session(env, sid, session_data) Base.silence do - record = env[SESSION_RECORD_KEY] ||= find_session(sid) + record = get_session_model(env, sid) record.data = session_data return false unless record.save @@ -309,6 +309,14 @@ module ActiveRecord return true end + + def get_session_model(env, sid) + if env[ENV_SESSION_OPTIONS_KEY][:id].nil? + env[SESSION_RECORD_KEY] = find_session(sid) + else + env[SESSION_RECORD_KEY] ||= find_session(sid) + end + end def find_session(id) @@session_class.find_by_session_id(id) || |