mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
session creation methods to a module
This commit is contained in:
parent
db93c1c125
commit
26e7678ab3
3 changed files with 11 additions and 24 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue