Skip to content

Instantly share code, notes, and snippets.

View chrisconcepcion's full-sized avatar

Christopher Concepcion chrisconcepcion

View GitHub Profile
@chrisconcepcion
chrisconcepcion / catching_errors.rb
Created March 22, 2023 17:37
Helpful Debugging Tips for Ruby on Rails
class ApplicationController < ActionController::Base
def log_error error_message
# Defining our log file path, can be named or located anywhere.
log_file_path = "#{Rails.root}/log/exception.log"
# Check if our log file exists.
file_available = File.exist? log_file_path
# Create log file if not available.
if file_available == false