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

Avoid double super call in some cases.

If super was false earlier, it is still going to be false, so we don't
need to call it again at the end of the method.
This commit is contained in:
Jon Leighton 2011-09-12 22:29:45 +01:00
parent ac687ed651
commit 6d8dbeca6b

View file

@ -431,15 +431,14 @@ module ActiveModel
alias :respond_to_without_attributes? :respond_to?
def respond_to?(method, include_private_methods = false)
if super
return true
true
elsif !include_private_methods && super(method, true)
# If we're here then we haven't found among non-private methods
# but found among all methods. Which means that the given method is private.
return false
elsif match_attribute_method?(method.to_s)
return true
false
else
!match_attribute_method?(method.to_s).nil?
end
super
end
protected