diff --git a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb index d902adaff1..64159fa8e7 100644 --- a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb +++ b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb @@ -65,12 +65,7 @@ module ActionDispatch end end - class AbstractStore < Rack::Session::Abstract::ID - include Compatibility - include StaleSessionCheck - - private - + module SessionObject # :nodoc: def prepare_session(env) Request::Session.create(self, env, @default_options) end @@ -78,6 +73,14 @@ module ActionDispatch def loaded_session?(session) !session.is_a?(Request::Session) || session.loaded? end + end + + class AbstractStore < Rack::Session::Abstract::ID + include Compatibility + include StaleSessionCheck + include SessionObject + + private def set_cookie(env, session_id, cookie) request = ActionDispatch::Request.new(env) diff --git a/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb b/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb index 8d673dd95e..dbcf703ec3 100644 --- a/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb +++ b/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb @@ -43,17 +43,10 @@ module ActionDispatch class CookieStore < Rack::Session::Cookie include Compatibility include StaleSessionCheck + include SessionObject private - def prepare_session(env) - Request::Session.create(self, env, @default_options) - end - - def loaded_session?(session) - !session.is_a?(Request::Session) || session.loaded? - end - def unpacked_cookie_data(env) env["action_dispatch.request.unsigned_session_cookie"] ||= begin stale_session_check! do diff --git a/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb b/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb index c51cbddfb5..38a737cd2b 100644 --- a/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb +++ b/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb @@ -6,22 +6,13 @@ module ActionDispatch class MemCacheStore < Rack::Session::Memcache include Compatibility include StaleSessionCheck + include SessionObject def initialize(app, options = {}) require 'memcache' options[:expire_after] ||= options[:expires] super end - - private - - def prepare_session(env) - Request::Session.create(self, env, @default_options) - end - - def loaded_session?(session) - !session.is_a?(Request::Session) || session.loaded? - end end end end