提交 3fb623fa 编写于 作者: J Joshua Peek

SessionRestoreError belongs in AD

上级 542ddde5
...@@ -44,7 +44,6 @@ module ActionController ...@@ -44,7 +44,6 @@ module ActionController
autoload :Cookies, 'action_controller/metal/cookies' autoload :Cookies, 'action_controller/metal/cookies'
autoload :ActionControllerError, 'action_controller/metal/exceptions' autoload :ActionControllerError, 'action_controller/metal/exceptions'
autoload :SessionRestoreError, 'action_controller/metal/exceptions'
autoload :RenderError, 'action_controller/metal/exceptions' autoload :RenderError, 'action_controller/metal/exceptions'
autoload :RoutingError, 'action_controller/metal/exceptions' autoload :RoutingError, 'action_controller/metal/exceptions'
autoload :MethodNotAllowed, 'action_controller/metal/exceptions' autoload :MethodNotAllowed, 'action_controller/metal/exceptions'
......
...@@ -2,9 +2,6 @@ module ActionController ...@@ -2,9 +2,6 @@ module ActionController
class ActionControllerError < StandardError #:nodoc: class ActionControllerError < StandardError #:nodoc:
end end
class SessionRestoreError < ActionControllerError #:nodoc:
end
class RenderError < ActionControllerError #:nodoc: class RenderError < ActionControllerError #:nodoc:
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module ActionDispatch # :nodoc: module ActionDispatch # :nodoc:
# Represents an HTTP response generated by a controller action. One can use # Represents an HTTP response generated by a controller action. One can use
# an ActionController::Response object to retrieve the current state # an ActionDispatch::Response object to retrieve the current state
# of the response, or customize the response. An Response object can # of the response, or customize the response. An Response object can
# either represent a "real" HTTP response (i.e. one that is meant to be sent # either represent a "real" HTTP response (i.e. one that is meant to be sent
# back to the web browser) or a test response (i.e. one that is generated # back to the web browser) or a test response (i.e. one that is generated
...@@ -18,14 +18,14 @@ module ActionDispatch # :nodoc: ...@@ -18,14 +18,14 @@ module ActionDispatch # :nodoc:
# Nevertheless, integration tests may want to inspect controller responses in # Nevertheless, integration tests may want to inspect controller responses in
# more detail, and that's when Response can be useful for application # more detail, and that's when Response can be useful for application
# developers. Integration test methods such as # developers. Integration test methods such as
# ActionController::Integration::Session#get and # ActionDispatch::Integration::Session#get and
# ActionController::Integration::Session#post return objects of type # ActionDispatch::Integration::Session#post return objects of type
# TestResponse (which are of course also of type Response). # TestResponse (which are of course also of type Response).
# #
# For example, the following demo integration "test" prints the body of the # For example, the following demo integration "test" prints the body of the
# controller response to the console: # controller response to the console:
# #
# class DemoControllerTest < ActionController::IntegrationTest # class DemoControllerTest < ActionDispatch::IntegrationTest
# def test_print_root_path_to_console # def test_print_root_path_to_console
# get('/') # get('/')
# puts @response.body # puts @response.body
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
module ActionDispatch module ActionDispatch
module Session module Session
class SessionRestoreError < StandardError #:nodoc:
end
class AbstractStore class AbstractStore
ENV_SESSION_KEY = 'rack.session'.freeze ENV_SESSION_KEY = 'rack.session'.freeze
ENV_SESSION_OPTIONS_KEY = 'rack.session.options'.freeze ENV_SESSION_OPTIONS_KEY = 'rack.session.options'.freeze
...@@ -19,7 +22,7 @@ def initialize(by, env) ...@@ -19,7 +22,7 @@ def initialize(by, env)
def session_id def session_id
ActiveSupport::Deprecation.warn( ActiveSupport::Deprecation.warn(
"ActionController::Session::AbstractStore::SessionHash#session_id " + "ActionDispatch::Session::AbstractStore::SessionHash#session_id " +
"has been deprecated. Please use request.session_options[:id] instead.", caller) "has been deprecated. Please use request.session_options[:id] instead.", caller)
@env[ENV_SESSION_OPTIONS_KEY][:id] @env[ENV_SESSION_OPTIONS_KEY][:id]
end end
...@@ -62,7 +65,7 @@ def delete(key = nil) ...@@ -62,7 +65,7 @@ def delete(key = nil)
def data def data
ActiveSupport::Deprecation.warn( ActiveSupport::Deprecation.warn(
"ActionController::Session::AbstractStore::SessionHash#data " + "ActionDispatch::Session::AbstractStore::SessionHash#data " +
"has been deprecated. Please use #to_hash instead.", caller) "has been deprecated. Please use #to_hash instead.", caller)
to_hash to_hash
end end
...@@ -98,7 +101,7 @@ def stale_session_check! ...@@ -98,7 +101,7 @@ def stale_session_check!
# Note that the regexp does not allow $1 to end with a ':' # Note that the regexp does not allow $1 to end with a ':'
$1.constantize $1.constantize
rescue LoadError, NameError => const_error rescue LoadError, NameError => const_error
raise ActionController::SessionRestoreError, "Session contains objects whose class definition isn't available.\nRemember to require the classes for all objects kept in the session.\n(Original exception: #{const_error.message} [#{const_error.class}])\n" raise ActionDispatch::SessionRestoreError, "Session contains objects whose class definition isn't available.\nRemember to require the classes for all objects kept in the session.\n(Original exception: #{const_error.message} [#{const_error.class}])\n"
end end
retry retry
......
module ActionDispatch module ActionDispatch
# Integration test methods such as ActionController::Integration::Session#get # Integration test methods such as ActionDispatch::Integration::Session#get
# and ActionController::Integration::Session#post return objects of class # and ActionDispatch::Integration::Session#post return objects of class
# TestResponse, which represent the HTTP response results of the requested # TestResponse, which represent the HTTP response results of the requested
# controller actions. # controller actions.
# #
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册