From ebe73abea0ae02094ddc28f8fd60ae92373b6113 Mon Sep 17 00:00:00 2001 From: Yuki Nishijima Date: Fri, 6 Feb 2015 11:52:41 -0800 Subject: [PATCH] NameError#missing_name? can jsut use NameError#name if the arg is a Symbol NameError#name returns a missing name as a symbol, so if the given name is a symbol, it doesn't have to use #missing_name to get the last constant name in the error message. --- activesupport/lib/active_support/core_ext/name_error.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/name_error.rb b/activesupport/lib/active_support/core_ext/name_error.rb index b82148e4e5..6b447d772b 100644 --- a/activesupport/lib/active_support/core_ext/name_error.rb +++ b/activesupport/lib/active_support/core_ext/name_error.rb @@ -23,8 +23,7 @@ def missing_name # # => true def missing_name?(name) if name.is_a? Symbol - last_name = (missing_name || '').split('::').last - last_name == name.to_s + self.name == name else missing_name == name.to_s end