0

When working on a web app in python/flask, I am able to import pdb at the top of a file, and then call pdb.set_trace() somewhere in my code to "pause" the web app and open an interactive console in my terminal for debugging. I am looking for something similar in Ruby/Rails. What exists for this purpose, and how do I use it?

Nathan McCallum
  • 237
  • 1
  • 4
  • 18
Jason B
  • 7,097
  • 8
  • 38
  • 49

2 Answers2

1

Pry (and pry-remote) might be what you're looking for. I have no experience with it, but this is what it's supposed to let you do.

https://github.com/mon-ouie/pry-remote

Philip Hallstrom
  • 19,673
  • 2
  • 42
  • 46
0

I have found a solution.

The gem debugger is created for this purpose. To start, run

gem install debugger

After, add the line debugger into your code to "pause" the code at that point. For example:

def hello
    @users = Users.all()
    debugger
end

Then, when starting the server, call it with:

rails server --debugger
Jason B
  • 7,097
  • 8
  • 38
  • 49