1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #11850 from razielgn/mod-delegation-backtrace

Generalize backtrace check on DelegationError.
This commit is contained in:
Rafael Mendonça França 2013-08-21 09:14:58 -07:00
commit 6aaa0447b0

View file

@ -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