Class: ErrorLogsController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
# File 'app/controllers/error_logs_controller.rb', line 4

def index
  @error_logs = ErrorLog.order(created_at: :desc)
  if params[:q].present?
    @error_logs = @error_logs.where("message ILIKE :q OR target_name ILIKE :q OR parent_name ILIKE :q OR target_type ILIKE :q", q: "%#{params[:q]}%")
  end
  @error_logs = @error_logs.limit(100)
end

#showObject



12
13
14
15
# File 'app/controllers/error_logs_controller.rb', line 12

def show
  @error_log = ErrorLog.find_by(slug: params[:id])
  return redirect_to error_logs_path, alert: "Error log not found" unless @error_log
end