Class: Findbug::ErrorsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/findbug/errors_controller.rb

Overview

ErrorsController handles error listing and detail views.

Instance Method Summary collapse

Instance Method Details

#ignoreObject

POST /findbug/errors/:id/ignore

Mark error as ignored.



55
56
57
58
59
# File 'app/controllers/findbug/errors_controller.rb', line 55

def ignore
  @error.ignore!
  flash_success "Error marked as ignored"
  redirect_back(fallback_location: findbug.errors_path)
end

#indexObject

GET /findbug/errors

List all errors with filtering.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/findbug/errors_controller.rb', line 13

def index
  @errors = Findbug::ErrorEvent.all

  # Apply filters
  @errors = apply_filters(@errors)

  # Pagination
  @page = (params[:page] || 1).to_i
  @per_page = 25
  @total_count = @errors.count
  @errors = @errors.offset((@page - 1) * @per_page).limit(@per_page)

  render template: "findbug/errors/index", layout: "findbug/application"
end

#reopenObject

POST /findbug/errors/:id/reopen

Reopen a resolved/ignored error.



65
66
67
68
69
# File 'app/controllers/findbug/errors_controller.rb', line 65

def reopen
  @error.reopen!
  flash_success "Error reopened"
  redirect_back(fallback_location: findbug.errors_path)
end

#resolveObject

POST /findbug/errors/:id/resolve

Mark error as resolved.



45
46
47
48
49
# File 'app/controllers/findbug/errors_controller.rb', line 45

def resolve
  @error.resolve!
  flash_success "Error marked as resolved"
  redirect_back(fallback_location: findbug.errors_path)
end

#showObject

GET /findbug/errors/:id

Show error details.



32
33
34
35
36
37
38
39
# File 'app/controllers/findbug/errors_controller.rb', line 32

def show
  @similar_errors = Findbug::ErrorEvent.where(exception_class: @error.exception_class)
                              .where.not(id: @error.id)
                              .recent
                              .limit(5)

  render template: "findbug/errors/show", layout: "findbug/application"
end