Class: RailsExceptionLogger::LoggedExceptionsController

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

Instance Method Summary collapse

Instance Method Details

#clearObject



75
76
77
78
# File 'app/controllers/rails_exception_logger/logged_exceptions_controller.rb', line 75

def clear
  LoggedException.delete_all
  redirect_to :back
end

#destroyObject



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

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

#destroy_allObject



70
71
72
73
# File 'app/controllers/rails_exception_logger/logged_exceptions_controller.rb', line 70

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

#feedObject



48
49
50
51
52
53
54
# File 'app/controllers/rails_exception_logger/logged_exceptions_controller.rb', line 48

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



13
14
15
16
17
# File 'app/controllers/rails_exception_logger/logged_exceptions_controller.rb', line 13

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

#queryObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/rails_exception_logger/logged_exceptions_controller.rb', line 19

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 => 30)

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

#showObject



56
57
58
59
60
61
62
63
# File 'app/controllers/rails_exception_logger/logged_exceptions_controller.rb', line 56

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

  respond_to do |format|
    format.js
    format.html
  end
end