Commit 1568867158c3da520dc2cfb228ff5c39b7d11788
1 parent
71b47709
Exists in
master
and in
1 other branch
Fixed multiple "Rendered notices/_backtrace_line" messages in logs by using rend…
…er :partial => *, :collection => line_group, :as => :line
Showing
2 changed files
with
6 additions
and
15 deletions
Show diff stats
app/helpers/notices_helper.rb
... | ... | @@ -46,14 +46,6 @@ module NoticesHelper |
46 | 46 | line_groups |
47 | 47 | end |
48 | 48 | |
49 | - def rows_for_line_segment(lines, start, length, row_class = nil) | |
50 | - html = "" | |
51 | - lines[start, length].each do |line| | |
52 | - html << render(:partial => "notices/backtrace_line", :locals => {:line => line, :row_class => row_class}) | |
53 | - end | |
54 | - html.html_safe | |
55 | - end | |
56 | - | |
57 | 49 | def path_for_backtrace_line(line) |
58 | 50 | path = File.dirname(line['file']) |
59 | 51 | path == "." ? "" : path + '/' | ... | ... |
app/views/notices/_backtrace.html.haml
... | ... | @@ -2,16 +2,15 @@ |
2 | 2 | %table.backtrace |
3 | 3 | -# Group lines into internal / external so we can toggle the external backtrace |
4 | 4 | -# Includes a margin of x lines that are not toggled. |
5 | - - external_margin = 3 | |
5 | + - em = 3 # (external backtrace margin) | |
6 | 6 | - grouped_lines(lines).each do |in_app, line_group| |
7 | - - if !in_app && line_group.size > (external_margin * 3) | |
8 | - = rows_for_line_segment(line_group, 0, external_margin) | |
9 | - = rows_for_line_segment(line_group, 2, line_group.size - (external_margin * 2), 'hidden_external_backtrace') | |
7 | + - if !in_app && line_group.size > (em * 3) | |
8 | + = render :partial => 'notices/backtrace_line', :collection => line_group[0, em], :as => :line | |
9 | + = render :partial => 'notices/backtrace_line', :collection => line_group[em, line_group.size - (em * 2)], :as => :line, :locals => {:row_class => 'hidden_external_backtrace'} | |
10 | 10 | %tr |
11 | 11 | %td.line.backtrace_separator |
12 | 12 | %span ... |
13 | - = rows_for_line_segment(line_group, external_margin * -1, external_margin) | |
13 | + = render :partial => 'notices/backtrace_line', :collection => line_group[em * -1, em], :as => :line | |
14 | 14 | |
15 | 15 | - else |
16 | - - line_group.each do |line| | |
17 | - = render :partial => "notices/backtrace_line", :locals => {:line => line} | |
16 | + = render :partial => "notices/backtrace_line", :collection => line_group, :as => :line | ... | ... |