diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/template_error.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/actionpack/lib/action_view/template_error.rb b/actionpack/lib/action_view/template_error.rb index 0ac8ee4c37..5fa7f2db5e 100644 --- a/actionpack/lib/action_view/template_error.rb +++ b/actionpack/lib/action_view/template_error.rb @@ -49,14 +49,13 @@ module ActionView end def line_number - begin - @original_exception.backtrace.join.scan(/\((?:erb)\):([0-9]*)/).first.first.to_i - rescue - begin - original_exception.message.scan(/\((?:eval)\):([0-9]*)/).first.first.to_i - rescue - 1 - end + trace = @original_exception.backtrace.join + if trace.include?("erb):") + trace.scan(/\((?:erb)\):([0-9]*)/).first.first.to_i + elsif trace.include?("eval):") + trace.scan(/\((?:eval)\):([0-9]*)/).first.first.to_i + else + 1 end end |