From 20ad04e5fcfd5b972bfffb6c47b44646c41b8a82 Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Mon, 3 Nov 2014 22:59:45 +0200 Subject: Rename #source_extract to #source_extracts in ExceptionWrapper It returns multiple source extracts since 1ed264bc. Also cleaned its result structure, as we no longer need the file in a code extract. --- actionpack/lib/action_dispatch/middleware/debug_exceptions.rb | 2 +- actionpack/lib/action_dispatch/middleware/exception_wrapper.rb | 4 ++-- .../action_dispatch/middleware/templates/rescues/_source.erb | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb index 798c087d64..9651692952 100644 --- a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb @@ -53,7 +53,7 @@ module ActionDispatch show_source_idx: source_to_show_id, trace_to_show: trace_to_show, routes_inspector: routes_inspector(exception), - source_extract: wrapper.source_extract, + source_extracts: wrapper.source_extracts, line_number: wrapper.line_number, file: wrapper.file ) diff --git a/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb b/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb index b8381aba70..49f526d6be 100644 --- a/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb +++ b/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb @@ -81,13 +81,13 @@ module ActionDispatch Rack::Utils.status_code(@@rescue_responses[class_name]) end - def source_extract + def source_extracts backtrace.map do |trace| file, line = trace.split(":") line_number = line.to_i + { code: source_fragment(file, line_number), - file: file, line_number: line_number } end diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb index 101cea13f9..e7b913bbe4 100644 --- a/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb +++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb @@ -1,22 +1,22 @@ -<% @source_extract.each_with_index do |extract_source, index| %> - <% if extract_source[:code] %> +<% @source_extracts.each_with_index do |source_extract, index| %> + <% if source_extract[:code] %>
" id="frame-source-<%=index%>">
- Extracted source (around line #<%= extract_source[:line_number] %>): + Extracted source (around line #<%= source_extract[:line_number] %>):
-- cgit v1.2.3
-                <% extract_source[:code].each_key do |line_number| %>
+                <% source_extract[:code].each_key do |line_number| %>
 <%= line_number -%>
                 <% end %>
               
-<% extract_source[:code].each do |line, source| -%>
"><%= source -%>
<% end -%> +<% source_extract[:code].each do |line, source| -%>
"><%= source -%>
<% end -%>