From 979e198c14a95010aca17b6e640f386961360794 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Fri, 22 Feb 2013 14:26:20 -0500 Subject: [PATCH] Check for `method_missing` in public and protected Ruby 2.0 changed the behavior of `respond_to?` without argument to return only search for public method. We actually want to perform the action only if `method_missing` is either in public or protected. --- actionpack/lib/action_controller/metal/compatibility.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index de3354d4f9807..9d1ff8cbe4bab 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -58,7 +58,8 @@ def _handle_method_missing end def method_for_action(action_name) - super || (respond_to?(:method_missing) && "_handle_method_missing") + super || ((self.class.public_method_defined?(:method_missing) || + self.class.protected_method_defined?(:method_missing)) && "_handle_method_missing") end end end