diff options
-rw-r--r-- | actionpack/test/activerecord/active_record_store_test.rb | 20 | ||||
-rw-r--r-- | activerecord/lib/active_record/session_store.rb | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/activerecord/active_record_store_test.rb b/actionpack/test/activerecord/active_record_store_test.rb index f5811a1530..7c595d1b89 100644 --- a/actionpack/test/activerecord/active_record_store_test.rb +++ b/actionpack/test/activerecord/active_record_store_test.rb @@ -27,6 +27,12 @@ class ActiveRecordStoreTest < ActionDispatch::IntegrationTest head :ok end + def renew + env["rack.session.options"][:renew] = true + session[:foo] = "baz" + head :ok + end + def rescue_action(e) raise end end @@ -64,6 +70,20 @@ class ActiveRecordStoreTest < ActionDispatch::IntegrationTest end end end + + define_method("test_renewing_with_#{class_name}_store") do + with_store class_name do + with_test_route_set do + get '/set_session_value' + assert_response :success + assert cookies['_session_id'] + + get '/renew' + assert_response :success + assert_not_equal [], headers['Set-Cookie'] + end + end + end end def test_getting_nil_session_value diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index a64c5f80c9..ba99800fb2 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -321,6 +321,7 @@ module ActiveRecord if sid = current_session_id(env) Base.silence do get_session_model(env, sid).destroy + env[SESSION_RECORD_KEY] = nil end end |