Ask A Question

Notifications

You’re not receiving notifications from this thread.

Better Debugging With The Ruby Debug Gem Discussion

Thanks Kylo Ren!

Reply

Nice video, Collin!

One thing I might add is how to get into a debug console when you're running the default bin/dev script. I spin up another console and run "bundle exec rdbg -a" to attach to the debug process. Is there any easier way to get all the goodness of the debug gem in way that integrates into the bin/dev foreman setup?

Reply

That's a great tip!

VS Code also has an extension you can use https://github.com/ruby/vscode-rdbg

The other option is to replace foreman with overmind which allows you to do the same thing by opening another terminal and running overmind connect web to connect to the process. This will work with binding.irb, pry & debug or anything else.

Here's my bin/dev

#!/usr/bin/env sh

PORT="${PORT:-3000}"
export PORT

if command -v overmind > /dev/null 2>&1; then
  exec overmind start -f Procfile.dev "$@"
else
  exec foreman start -f Procfile.dev "$@"
fi
Reply

Awesome...thanks, Chris! And yah, I feel like I'm swimming upstream by running Sublime instead of VSCode, but old dogs and new tricks, eh?

Reply

Your bin/dev script looks well-configured to handle either Foreman or Overmind depending on availability.

Reply

hey mate just type in binding.break - you don't need to stuff around with getting into the IRB and THEN debugging from there.

Reply

Hey there, I appreciate the comment. I do address this in the video though in addition to being able to use debugger instead of / in addition to binding.break.

Reply

Thanks, definitely learned new things!

Reply

Awesome! Glad to hear that Giedrius!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,453+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.