Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 6d8dbeca6b0e676145ecdbba38f2fe56b74b4f8f 1 parent ac687ed
@jonleighton jonleighton authored
Showing with 4 additions and 5 deletions.
  1. +4 −5 activemodel/lib/active_model/attribute_methods.rb
View
9 activemodel/lib/active_model/attribute_methods.rb
@@ -431,15 +431,14 @@ def method_missing(method, *args, &block)
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
Please sign in to comment.
Something went wrong with that request. Please try again.