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

All intermediate delegation methods should preserve kwargs flag

Since 0456826180,
`foo(*caller_args)` method call delegation no longer preserve kwargs
flag.

Fixes #44846.
This commit is contained in:
Ryuta Kamizono 2022-04-06 14:40:03 +09:00
parent 22ca875f9c
commit 714fd07fd9
7 changed files with 10 additions and 7 deletions

View file

@ -624,6 +624,7 @@ module ActionMailer
@_message = NullMail.new unless @_mail_was_called @_message = NullMail.new unless @_mail_was_called
end end
end end
ruby2_keywords(:process)
class NullMail # :nodoc: class NullMail # :nodoc:
def body; "" end def body; "" end

View file

@ -20,7 +20,7 @@ module ActionMailer # :nodoc:
end end
private private
def process(*) def process(...)
handle_exceptions do handle_exceptions do
super super
end end

View file

@ -155,6 +155,7 @@ module AbstractController
process_action(action_name, *args) process_action(action_name, *args)
end end
ruby2_keywords(:process)
# Delegates to the class's ::controller_path. # Delegates to the class's ::controller_path.
def controller_path def controller_path
@ -215,8 +216,8 @@ module AbstractController
# #
# Notice that the first argument is the method to be dispatched # Notice that the first argument is the method to be dispatched
# which is *not* necessarily the same as the action name. # which is *not* necessarily the same as the action name.
def process_action(method_name, *args) def process_action(...)
send_action(method_name, *args) send_action(...)
end end
# Actually call the method associated with the action. Override # Actually call the method associated with the action. Override

View file

@ -244,7 +244,7 @@ module AbstractController
private private
# Override <tt>AbstractController::Base#process_action</tt> to run the # Override <tt>AbstractController::Base#process_action</tt> to run the
# <tt>process_action</tt> callbacks around the normal behavior. # <tt>process_action</tt> callbacks around the normal behavior.
def process_action(*) def process_action(...)
run_callbacks(:process_action) do run_callbacks(:process_action) do
super super
end end

View file

@ -34,7 +34,7 @@ module ActionView
end end
# Override process to set up I18n proxy. # Override process to set up I18n proxy.
def process(*) # :nodoc: def process(...) # :nodoc:
old_config, I18n.config = I18n.config, I18nProxy.new(I18n.config, lookup_context) old_config, I18n.config = I18n.config, I18nProxy.new(I18n.config, lookup_context)
super super
ensure ensure

View file

@ -471,6 +471,7 @@ module ActiveModel
def attribute_missing(match, *args, &block) def attribute_missing(match, *args, &block)
__send__(match.proxy_target, match.attr_name, *args, &block) __send__(match.proxy_target, match.attr_name, *args, &block)
end end
ruby2_keywords(:attribute_missing)
# A +Person+ instance with a +name+ attribute can ask # A +Person+ instance with a +name+ attribute can ask
# <tt>person.respond_to?(:name)</tt>, <tt>person.respond_to?(:name=)</tt>, # <tt>person.respond_to?(:name)</tt>, <tt>person.respond_to?(:name=)</tt>,

View file

@ -429,10 +429,10 @@ module ActiveRecord
end end
end end
def _exec_scope(*args, &block) # :nodoc: def _exec_scope(...) # :nodoc:
@delegate_to_klass = true @delegate_to_klass = true
registry = klass.scope_registry registry = klass.scope_registry
_scoping(nil, registry) { instance_exec(*args, &block) || self } _scoping(nil, registry) { instance_exec(...) || self }
ensure ensure
@delegate_to_klass = false @delegate_to_klass = false
end end