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?

2

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.