From e3cd36f264b3e37fab73e07d9fca25222430c059 Mon Sep 17 00:00:00 2001 From: Yoshimoto Date: Wed, 22 Aug 2012 11:07:38 +0900 Subject: [PATCH] fixes method name in exception message is correctly set --- lib/active_decorator/helpers.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/active_decorator/helpers.rb b/lib/active_decorator/helpers.rb index 02193750..abfc2965 100644 --- a/lib/active_decorator/helpers.rb +++ b/lib/active_decorator/helpers.rb @@ -6,7 +6,15 @@ def method_missing(method, *args, &block) rescue NoMethodError, NameError => original_error begin ActiveDecorator::ViewContext.current.send method, *args, &block - rescue NoMethodError, NameError + rescue NoMethodError, NameError => e + original_error.to_s =~ %r"(`.*')" + original_method = $1 + + if e.to_s =~ %r"(`.*')" && original_method == $1 + raise original_error + end + + original_error.message.gsub! %r"`.*'", $1 raise original_error end end