aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorFederico Ravasio <ravasio.federico@gmail.com>2013-08-12 11:43:42 +0200
committerFederico Ravasio <ravasio.federico@gmail.com>2013-08-12 14:54:30 +0200
commitcbd2111c67b1603c97c00ebbd5f6f67e4b24eebd (patch)
tree60023da2ace53110462c659cbe7420be1e4fcc0d /activesupport
parent0f834868bfd0d98c6d144543bc49c86df53e9a91 (diff)
downloadrails-cbd2111c67b1603c97c00ebbd5f6f67e4b24eebd.tar.gz
rails-cbd2111c67b1603c97c00ebbd5f6f67e4b24eebd.tar.bz2
rails-cbd2111c67b1603c97c00ebbd5f6f67e4b24eebd.zip
Rely on NoMethodError#name when deciding to raise DelegationError.
Different Ruby implementations present backtraces differently, as it should be an information consumed by humans. A better implementation should use data from the error, in this case returned by NoMethodError#name. Fixes issues with Rubinius, which presents backtraces differently from MRI.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/module/delegation.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb
index bca3800344..182e74d9e1 100644
--- a/activesupport/lib/active_support/core_ext/module/delegation.rb
+++ b/activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -192,8 +192,7 @@ class Module
_ = #{to} # _ = client
_.#{method}(#{definition}) # _.name(*args, &block)
rescue NoMethodError => e # rescue NoMethodError => e
- location = "%s:%d:in `%s'" % [__FILE__, __LINE__ - 2, '#{method_prefix}#{method}'] # location = "%s:%d:in `%s'" % [__FILE__, __LINE__ - 2, 'customer_name']
- if _.nil? && e.backtrace.first == location # if _.nil? && e.backtrace.first == location
+ if _.nil? && e.name == :#{method} # if _.nil? && e.name == :name
#{exception} # # add helpful message to the exception
else # else
raise # raise