提交 981f6963 编写于 作者: P Pratik Naik

Relation#respond_to? should take second argument for responding to private methods

上级 bc933d0f
......@@ -142,8 +142,8 @@ def where(*args)
create_new_relation(@relation.where(conditions))
end
def respond_to?(method)
return true if @relation.respond_to?(method) || Array.method_defined?(method)
def respond_to?(method, include_private = false)
return true if @relation.respond_to?(method, include_private) || Array.method_defined?(method)
if match = DynamicFinderMatch.match(method)
return true if @klass.send(:all_attributes_exists?, match.attribute_names)
......
......@@ -146,6 +146,13 @@ def test_scoped_responds_to_delegated_methods
end
end
def test_respond_to_private_arel_methods
relation = Topic.scoped
assert ! relation.respond_to?(:matching_attributes)
assert relation.respond_to?(:matching_attributes, true)
end
def test_respond_to_dynamic_finders
relation = Topic.scoped
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册