Class: NdrError::ErrorsController

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

Overview

Controller for viewing and managing errors

Instance Method Summary collapse

Instance Method Details

#destroyObject



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

def destroy
  flash[:error] = 'Fingerprint purged!' if @fingerprint.purge!

  redirect_to error_fingerprints_url
end

#editObject



30
31
# File 'app/controllers/ndr_error/errors_controller.rb', line 30

def edit
end

#indexObject



7
8
9
10
11
12
13
14
# File 'app/controllers/ndr_error/errors_controller.rb', line 7

def index
  if NdrError::Log.perform_cleanup!
    flash[:notice] = 'Scheduled deletion of historical logs completed.'
  end

  @keywords     = extract_keywords(params[:q])
  @fingerprints = NdrError.paginate(@keywords, params[:page])
end

#showObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/ndr_error/errors_controller.rb', line 16

def show
  @error =
    if (id = params[:log_id])
      @fingerprint.error_logs.find(id)
    else
      @fingerprint.error_logs.first
    end

  return unless @error.nil?

  flash[:error] = 'No matching Logs exist for that Fingerprint!'
  redirect_to error_fingerprints_url(q: @fingerprint.to_param)
end

#updateObject



33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/ndr_error/errors_controller.rb', line 33

def update
  @fingerprint.ticket_url = params[:error_fingerprint][:ticket_url]

  if @fingerprint.save
    flash[:notice] = 'The Error Fingerprint was successfully updated!'
    redirect_to error_fingerprint_url(@fingerprint)
  else
    flash.now[:error] = errors_for(@fingerprint)
    render 'edit'
  end
end