Log SQL queries in the Rails console

21-Jul-2026 7
When debug queries in the console I often want to see the raw DB queries being made. Here's a quick little piece of code which will make those queries visible in the console.

Free eBook download

Download all our eBooks for free from Gumroad!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these books offer thousands of essential questions and answers across multiple languages. Download the complete collection for free from our Gumroad page. Free Ultimate Job Interview Preparation eBook collection