Commit 025c89ad11cf5b354bdee6976e2c62d3c6a0f529

Authored by Stephen Crosby
1 parent ac9b0a43
Exists in master and in 1 other branch production

fix Problems#show action after mongoid5 refactor

app/controllers/problems_controller.rb
... ... @@ -50,9 +50,9 @@ class ProblemsController < ApplicationController
50 50 def index; end
51 51  
52 52 def show
53   - @notices = problem.object.notices.reverse_ordered
  53 + @notices = problem.object.notices.reverse_ordered
54 54 .page(params[:notice]).per(1)
55   - @notice = @notices.first
  55 + @notice = NoticeDecorator.new @notices.first
56 56 @comment = Comment.new
57 57 end
58 58  
... ...
app/decorators/backtrace_line_decorator.rb
... ... @@ -9,6 +9,10 @@ class BacktraceLineDecorator < Draper::Decorator
9 9 object[:number]
10 10 end
11 11  
  12 + def column
  13 + object[:column]
  14 + end
  15 +
12 16 def file
13 17 object[:file]
14 18 end
... ... @@ -35,6 +39,14 @@ class BacktraceLineDecorator < Draper::Decorator
35 39 link_to_in_app_source_file(app, text) || text
36 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 50 private
39 51 def link_to_in_app_source_file(app, text)
40 52 return unless in_app?
... ...
app/models/backtrace.rb
... ... @@ -3,6 +3,7 @@ class Backtrace
3 3 include Mongoid::Timestamps
4 4  
5 5 IN_APP_PATH = %r{^\[PROJECT_ROOT\](?!(\/vendor))/?}
  6 + GEMS_PATH = %r{\[GEM_ROOT\]\/gems\/([^\/]+)}
6 7  
7 8 field :fingerprint
8 9 field :lines
... ...
app/views/problems/show.html.haml
... ... @@ -68,7 +68,7 @@
68 68  
69 69 #backtrace
70 70 %h3 Backtrace
71   - = render 'notices/backtrace', :lines => @notice.backtrace_lines
  71 + = render 'notices/backtrace', :lines => @notice.backtrace.lines
72 72  
73 73 - if @notice.user_attributes.present?
74 74 #user_attributes
... ...