Commit 025c89ad11cf5b354bdee6976e2c62d3c6a0f529
1 parent
ac9b0a43
Exists in
master
and in
1 other branch
fix Problems#show action after mongoid5 refactor
Showing
4 changed files
with
16 additions
and
3 deletions
Show diff stats
app/controllers/problems_controller.rb
@@ -50,9 +50,9 @@ class ProblemsController < ApplicationController | @@ -50,9 +50,9 @@ class ProblemsController < ApplicationController | ||
50 | def index; end | 50 | def index; end |
51 | 51 | ||
52 | def show | 52 | def show |
53 | - @notices = problem.object.notices.reverse_ordered | 53 | + @notices = problem.object.notices.reverse_ordered |
54 | .page(params[:notice]).per(1) | 54 | .page(params[:notice]).per(1) |
55 | - @notice = @notices.first | 55 | + @notice = NoticeDecorator.new @notices.first |
56 | @comment = Comment.new | 56 | @comment = Comment.new |
57 | end | 57 | end |
58 | 58 |
app/decorators/backtrace_line_decorator.rb
@@ -9,6 +9,10 @@ class BacktraceLineDecorator < Draper::Decorator | @@ -9,6 +9,10 @@ class BacktraceLineDecorator < Draper::Decorator | ||
9 | object[:number] | 9 | object[:number] |
10 | end | 10 | end |
11 | 11 | ||
12 | + def column | ||
13 | + object[:column] | ||
14 | + end | ||
15 | + | ||
12 | def file | 16 | def file |
13 | object[:file] | 17 | object[:file] |
14 | end | 18 | end |
@@ -35,6 +39,14 @@ class BacktraceLineDecorator < Draper::Decorator | @@ -35,6 +39,14 @@ class BacktraceLineDecorator < Draper::Decorator | ||
35 | link_to_in_app_source_file(app, text) || text | 39 | link_to_in_app_source_file(app, text) || text |
36 | end | 40 | end |
37 | 41 | ||
42 | + def path | ||
43 | + File.dirname(object[:file]).gsub(/^\.$/, '') + "/" | ||
44 | + end | ||
45 | + | ||
46 | + def decorated_path | ||
47 | + file_relative.sub(Backtrace::GEMS_PATH, "<strong>\\1</strong>") | ||
48 | + end | ||
49 | + | ||
38 | private | 50 | private |
39 | def link_to_in_app_source_file(app, text) | 51 | def link_to_in_app_source_file(app, text) |
40 | return unless in_app? | 52 | return unless in_app? |
app/models/backtrace.rb
@@ -3,6 +3,7 @@ class Backtrace | @@ -3,6 +3,7 @@ class Backtrace | ||
3 | include Mongoid::Timestamps | 3 | include Mongoid::Timestamps |
4 | 4 | ||
5 | IN_APP_PATH = %r{^\[PROJECT_ROOT\](?!(\/vendor))/?} | 5 | IN_APP_PATH = %r{^\[PROJECT_ROOT\](?!(\/vendor))/?} |
6 | + GEMS_PATH = %r{\[GEM_ROOT\]\/gems\/([^\/]+)} | ||
6 | 7 | ||
7 | field :fingerprint | 8 | field :fingerprint |
8 | field :lines | 9 | field :lines |
app/views/problems/show.html.haml
@@ -68,7 +68,7 @@ | @@ -68,7 +68,7 @@ | ||
68 | 68 | ||
69 | #backtrace | 69 | #backtrace |
70 | %h3 Backtrace | 70 | %h3 Backtrace |
71 | - = render 'notices/backtrace', :lines => @notice.backtrace_lines | 71 | + = render 'notices/backtrace', :lines => @notice.backtrace.lines |
72 | 72 | ||
73 | - if @notice.user_attributes.present? | 73 | - if @notice.user_attributes.present? |
74 | #user_attributes | 74 | #user_attributes |