Permalink
Browse files

Delegated methods report the expected file/line in backtraces

  • Loading branch information...
1 parent 5267add commit 50fe928c1539756cb1e3c5e7faf99c2b61979c08 @jeremy jeremy committed Jun 18, 2009
Showing with 3 additions and 2 deletions.
  1. +3 −2 activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -110,10 +110,11 @@ def delegate(*methods)
allow_nil = options[:allow_nil] && "#{to} && "
- file, line = caller[0].split(":")
+ file, line = caller.first.split(':', 2)
+ line = line.to_i
methods.each do |method|
- module_eval(<<-EOS, file, line.to_i)
+ module_eval(<<-EOS, file, line)
def #{prefix}#{method}(*args, &block) # def customer_name(*args, &block)
#{allow_nil}#{to}.__send__(#{method.inspect}, *args, &block) # client && client.__send__(:name, *args, &block)
end # end

0 comments on commit 50fe928

Please sign in to comment.