Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "Only save the session if we're actually writing to it [#2703

…state:resolved]"

This reverts commit dd98280.
  • Loading branch information...
commit a1140a10318a79b5dace11679f654c33f477ef57 1 parent 54984f0
@josh josh authored
View
11 actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
@@ -15,7 +15,6 @@ def initialize(by, env)
@by = by
@env = env
@loaded = false
- @updated = false
end
def session_id
@@ -33,7 +32,6 @@ def [](key)
def []=(key, value)
load! unless @loaded
super(key.to_s, value)
- @updated = true
end
def to_hash
@@ -81,10 +79,6 @@ def loaded?
@loaded
end
- def updated?
- @updated
- end
-
def load!
stale_session_check! do
id, session = @by.send(:load_session, @env)
@@ -153,10 +147,7 @@ def call(env)
options = env[ENV_SESSION_OPTIONS_KEY]
if !session_data.is_a?(AbstractStore::SessionHash) || session_data.send(:loaded?) || options[:expire_after]
- if session_data.is_a?(AbstractStore::SessionHash)
- session_data.send(:load!) if !session_data.send(:loaded?)
- return response if !session_data.send(:updated?)
- end
+ session_data.send(:load!) if session_data.is_a?(AbstractStore::SessionHash) && !session_data.send(:loaded?)
sid = options[:id] || generate_sid
View
22 actionpack/test/activerecord/active_record_store_test.rb
@@ -22,11 +22,6 @@ def get_session_value
render :text => "foo: #{session[:foo].inspect}"
end
- def set_cookie_and_get_session_value
- cookies["kittens"] = { :value => "fluffy" }
- render :text => "foo: #{session[:foo].inspect}"
- end
-
def get_session_id
session[:foo]
render :text => "#{request.session_options[:id]}"
@@ -83,23 +78,6 @@ def test_getting_nil_session_value
end
end
- def test_getting_session_value_does_not_set_cookie
- with_test_route_set do
- get '/get_session_value'
- assert_response :success
- assert_equal "", headers["Set-Cookie"]
- end
- end
-
- def test_getting_session_value_and_setting_a_cookie_doesnt_delete_all_cookies
- with_test_route_set do
- get '/set_cookie_and_get_session_value'
- assert_response :success
- assert_equal 'foo: nil', response.body
- assert_equal({"kittens" => "fluffy"}, response.cookies)
- end
- end
-
def test_setting_session_value_after_session_reset
with_test_route_set do
get '/set_session_value'
View
8 actionpack/test/dispatch/session/mem_cache_store_test.rb
@@ -61,14 +61,6 @@ def test_getting_nil_session_value
end
end
- def test_getting_session_value_does_not_set_cookie
- with_test_route_set do
- get '/get_session_value'
- assert_response :success
- assert_equal "", headers["Set-Cookie"]
- end
- end
-
def test_setting_session_value_after_session_reset
with_test_route_set do
get '/set_session_value'
Please sign in to comment.
Something went wrong with that request. Please try again.