Class: LoggedExceptionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/logged_exceptions_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



61
62
63
64
# File 'app/controllers/logged_exceptions_controller.rb', line 61

def destroy
  @exception = LoggedException.where(:id => params[:id]).first
  @exception.destroy
end

#destroy_allObject



66
67
68
69
# File 'app/controllers/logged_exceptions_controller.rb', line 66

def destroy_all
  LoggedException.delete_all(:id => params[:ids]) unless params[:ids].blank?
  query 
end

#feedObject



44
45
46
47
48
49
50
# File 'app/controllers/logged_exceptions_controller.rb', line 44

def feed
  @exceptions = LoggedException.all

  respond_to do |format|
    format.rss { render :layout => false }
  end
end

#indexObject

ApplicationController.class_eval do

rescue_from Exception, :with => :log_exception_handler

end



9
10
11
12
13
# File 'app/controllers/logged_exceptions_controller.rb', line 9

def index
  @exception_names    = LoggedException.class_names
  @controller_actions = LoggedException.controller_actions
  query
end

#queryObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/logged_exceptions_controller.rb', line 15

def query
  exceptions = LoggedException.sorted
  unless params[:id].blank?
    exceptions = exceptions.where(:id => params[:id])
  end
  unless params[:query].blank?
    exceptions = exceptions.message_like(params[:query])
  end
  unless params[:date_ranges_filter].blank?
    exceptions = exceptions.days_old(params[:date_ranges_filter])
  end
  unless params[:exception_names_filter].blank?
    exceptions = exceptions.by_exception_class(params[:exception_names_filter])
  end
  unless params[:controller_actions_filter].blank?
    c_a_params = params[:controller_actions_filter].split('/')
    controller_filter = c_a_params.first.underscore
    action_filter = c_a_params.last.downcase
    exceptions = exceptions.by_controller(controller_filter)
    exceptions = exceptions.by_action(action_filter)
  end
  @exceptions = exceptions.paginate(:page => params[:page], :per_page => 25)

  respond_to do |format|
    format.html { redirect_to :action => 'index' unless action_name == 'index' }
    format.js
  end
end

#showObject



52
53
54
55
56
57
58
59
# File 'app/controllers/logged_exceptions_controller.rb', line 52

def show
  @exception = LoggedException.where(:id => params[:id]).first
  
  respond_to do |format|
    format.js
    format.html
  end
end