提交 03d3f036 编写于 作者: S Sean Griffin

Override `respond_to_missing?` instead of `respond_to?` when possible

This was almost every case where we are overriding `respond_to?` in a
way that mirrors a parallel implementation of `method_missing`. There is
one remaining case in Active Model that should probably do the same
thing, but had a sufficiently strange implementation that I want to
investigate it separately.

Fixes #26333.
上级 4ba40bc2
......@@ -19,7 +19,7 @@ def url_options
end
end
def respond_to?(method, include_private = false)
def respond_to_missing?(method, include_private = false)
super || @helpers.respond_to?(method)
end
......
......@@ -502,7 +502,7 @@ def default_url_options=(options)
integration_session.default_url_options = options
end
def respond_to?(method, include_private = false)
def respond_to_missing?(method, include_private = false)
integration_session.respond_to?(method, include_private) || super
end
......
......@@ -2,7 +2,7 @@
module ActiveRecord
module DynamicMatchers #:nodoc:
def respond_to?(name, include_private = false)
def respond_to_missing?(name, include_private = false)
if self == Base
super
else
......
......@@ -92,7 +92,7 @@ def inverse_of(command, args, &block)
send(method, args, &block)
end
def respond_to?(*args) # :nodoc:
def respond_to_missing?(*args) # :nodoc:
super || delegate.respond_to?(*args)
end
......
......@@ -108,7 +108,7 @@ def relation_class_for(klass)
end
end
def respond_to?(method, include_private = false)
def respond_to_missing?(method, include_private = false)
super || @klass.respond_to?(method, include_private) ||
arel.respond_to?(method, include_private)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册