mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Keep process_action private when redefined
AbstractController::Base defines process_action as private, but modules included after redefine it as a public method.
This commit is contained in:
parent
e2b09c52ca
commit
5a471b6d8f
4 changed files with 49 additions and 48 deletions
|
@ -35,14 +35,6 @@ module AbstractController
|
||||||
skip_after_callbacks_if_terminated: true
|
skip_after_callbacks_if_terminated: true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Override <tt>AbstractController::Base#process_action</tt> to run the
|
|
||||||
# <tt>process_action</tt> callbacks around the normal behavior.
|
|
||||||
def process_action(*)
|
|
||||||
run_callbacks(:process_action) do
|
|
||||||
super
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
# If +:only+ or +:except+ are used, convert the options into the
|
# If +:only+ or +:except+ are used, convert the options into the
|
||||||
# +:if+ and +:unless+ options of ActiveSupport::Callbacks.
|
# +:if+ and +:unless+ options of ActiveSupport::Callbacks.
|
||||||
|
@ -220,5 +212,14 @@ module AbstractController
|
||||||
alias_method :"append_#{callback}_action", :"#{callback}_action"
|
alias_method :"append_#{callback}_action", :"#{callback}_action"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Override <tt>AbstractController::Base#process_action</tt> to run the
|
||||||
|
# <tt>process_action</tt> callbacks around the normal behavior.
|
||||||
|
def process_action(*)
|
||||||
|
run_callbacks(:process_action) do
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,33 +16,6 @@ module ActionController
|
||||||
|
|
||||||
attr_internal :view_runtime
|
attr_internal :view_runtime
|
||||||
|
|
||||||
def process_action(*)
|
|
||||||
raw_payload = {
|
|
||||||
controller: self.class.name,
|
|
||||||
action: action_name,
|
|
||||||
request: request,
|
|
||||||
params: request.filtered_parameters,
|
|
||||||
headers: request.headers,
|
|
||||||
format: request.format.ref,
|
|
||||||
method: request.request_method,
|
|
||||||
path: request.fullpath
|
|
||||||
}
|
|
||||||
|
|
||||||
ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload)
|
|
||||||
|
|
||||||
ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload|
|
|
||||||
result = super
|
|
||||||
payload[:response] = response
|
|
||||||
payload[:status] = response.status
|
|
||||||
result
|
|
||||||
rescue => error
|
|
||||||
payload[:status] = ActionDispatch::ExceptionWrapper.status_code_for_exception(error.class.name)
|
|
||||||
raise
|
|
||||||
ensure
|
|
||||||
append_info_to_payload(payload)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def render(*)
|
def render(*)
|
||||||
render_output = nil
|
render_output = nil
|
||||||
self.view_runtime = cleanup_view_runtime do
|
self.view_runtime = cleanup_view_runtime do
|
||||||
|
@ -74,6 +47,33 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
def process_action(*)
|
||||||
|
raw_payload = {
|
||||||
|
controller: self.class.name,
|
||||||
|
action: action_name,
|
||||||
|
request: request,
|
||||||
|
params: request.filtered_parameters,
|
||||||
|
headers: request.headers,
|
||||||
|
format: request.format.ref,
|
||||||
|
method: request.request_method,
|
||||||
|
path: request.fullpath
|
||||||
|
}
|
||||||
|
|
||||||
|
ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload)
|
||||||
|
|
||||||
|
ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload|
|
||||||
|
result = super
|
||||||
|
payload[:response] = response
|
||||||
|
payload[:status] = response.status
|
||||||
|
result
|
||||||
|
rescue => error
|
||||||
|
payload[:status] = ActionDispatch::ExceptionWrapper.status_code_for_exception(error.class.name)
|
||||||
|
raise
|
||||||
|
ensure
|
||||||
|
append_info_to_payload(payload)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# A hook invoked every time a before callback is halted.
|
# A hook invoked every time a before callback is halted.
|
||||||
def halted_callback_hook(filter, _)
|
def halted_callback_hook(filter, _)
|
||||||
ActiveSupport::Notifications.instrument("halted_callback.action_controller", filter: filter)
|
ActiveSupport::Notifications.instrument("halted_callback.action_controller", filter: filter)
|
||||||
|
|
|
@ -242,6 +242,7 @@ module ActionController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
# Performs parameters wrapping upon the request. Called automatically
|
# Performs parameters wrapping upon the request. Called automatically
|
||||||
# by the metal call stack.
|
# by the metal call stack.
|
||||||
def process_action(*)
|
def process_action(*)
|
||||||
|
@ -249,7 +250,6 @@ module ActionController
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
# Returns the wrapper key which will be used to store wrapped parameters.
|
# Returns the wrapper key which will be used to store wrapped parameters.
|
||||||
def _wrapper_key
|
def _wrapper_key
|
||||||
_wrapper_options.name
|
_wrapper_options.name
|
||||||
|
|
|
@ -24,12 +24,6 @@ module ActionController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Before processing, set the request formats in current controller formats.
|
|
||||||
def process_action(*) #:nodoc:
|
|
||||||
self.formats = request.formats.filter_map(&:ref)
|
|
||||||
super
|
|
||||||
end
|
|
||||||
|
|
||||||
# Check for double render errors and set the content_type after rendering.
|
# Check for double render errors and set the content_type after rendering.
|
||||||
def render(*args) #:nodoc:
|
def render(*args) #:nodoc:
|
||||||
raise ::AbstractController::DoubleRenderError if response_body
|
raise ::AbstractController::DoubleRenderError if response_body
|
||||||
|
@ -53,6 +47,12 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
# Before processing, set the request formats in current controller formats.
|
||||||
|
def process_action(*) #:nodoc:
|
||||||
|
self.formats = request.formats.filter_map(&:ref)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
def _process_variant(options)
|
def _process_variant(options)
|
||||||
if defined?(request) && !request.nil? && request.variant.present?
|
if defined?(request) && !request.nil? && request.variant.present?
|
||||||
options[:variant] = request.variant
|
options[:variant] = request.variant
|
||||||
|
|
Loading…
Reference in a new issue