From 6d8dbeca6b0e676145ecdbba38f2fe56b74b4f8f Mon Sep 17 00:00:00 2001
From: Jon Leighton <j@jonathanleighton.com>
Date: Mon, 12 Sep 2011 22:29:45 +0100
Subject: 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.
---
 activemodel/lib/active_model/attribute_methods.rb | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index baebc91192..39ece6d3b3 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -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
-- 
cgit v1.2.3