Using Rails debugger/rdbg with VS Code

03-Jun-2024 602
Until recently, I was dropping debugger statements in my code and interacting with them via the terminal (like a filthy peasant 😭).That was starting to irk me! Particularly at work, I found that with both a sidekiq: and web: process running locally, it was tricky to debug properly since I'd have a bunch of sidekiq: logs flying by while I was trying to investigate the web: process.What if there was a better way? A way to connect directly to a debugger from within VS Code? Luckily, there is! Enter the VSCode rdbg Ruby Debugger extension — it's great and surprisingly easy to set up.By the end of this article, you're going to have that extension installed and connecting directly to debugger instances in your Ruby on Rails code within VS Code. I'll also show you how to use the rdbg VS Code extension to debug RSpec specs. Let's dive in!.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle