1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove ActionController::RaiseActionExceptions.

The latest modification to the code was done in https://github.com/rails/rails/commit/5e3517ea. In Rails 3.2,
`ActionController#rescue_action` was deprecated and `rescue_action_without_handler` is no longer being used.
This commit is contained in:
Guo Xiang Tan 2014-08-07 17:20:17 +08:00
parent e6e81f856e
commit 14508aec70

View file

@ -456,7 +456,6 @@ module ActionController
end end
def controller_class=(new_class) def controller_class=(new_class)
prepare_controller_class(new_class) if new_class
self._controller_class = new_class self._controller_class = new_class
end end
@ -473,11 +472,6 @@ module ActionController
Class === constant && constant < ActionController::Metal Class === constant && constant < ActionController::Metal
end end
end end
def prepare_controller_class(new_class)
new_class.send :include, ActionController::TestCase::RaiseActionExceptions
end
end end
# Simulate a GET request with the given parameters. # Simulate a GET request with the given parameters.
@ -713,34 +707,6 @@ module ActionController
end end
end end
# When the request.remote_addr remains the default for testing, which is 0.0.0.0, the exception is simply raised inline
# (skipping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular
# rescue_action process takes place. This means you can test your rescue_action code by setting remote_addr to something else
# than 0.0.0.0.
#
# The exception is stored in the exception accessor for further inspection.
module RaiseActionExceptions
def self.included(base) #:nodoc:
unless base.method_defined?(:exception) && base.method_defined?(:exception=)
base.class_eval do
attr_accessor :exception
protected :exception, :exception=
end
end
end
protected
def rescue_action_without_handler(e)
self.exception = e
if request.remote_addr == "0.0.0.0"
raise(e)
else
super(e)
end
end
end
include Behavior include Behavior
end end
end end