Skip to content

Instantly share code, notes, and snippets.

@dtbaker
Created January 24, 2023 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dtbaker/f5893ffcbb5833b0564515c8ded152ea to your computer and use it in GitHub Desktop.
Save dtbaker/f5893ffcbb5833b0564515c8ded152ea to your computer and use it in GitHub Desktop.
Debug SQL queries in rails app
module YourApp
class Application < Rails::Application
# all the things....
# Print SQL debug to the console
config.after_initialize do
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.verbose_query_logs = true
Rails.logger.level = Logger::DEBUG
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment