Nathan Long
Nathan Long

Reputation: 125912

Is there a way to step through a Rails app in a debugger?

Is there a way to step through a Rails app in a debugger as it handles a request?

Upvotes: 11

Views: 5824

Answers (4)

byterussian
byterussian

Reputation: 3609

Yes, use pry and pry-debugger. Visit http://pryrepl.org/ for more info.

Upvotes: 8

Pratik Khadloya
Pratik Khadloya

Reputation: 12869

I like the Rubymine debugger. Rubymine is a paid Rails IDE.

Upvotes: 1

Snowcrash
Snowcrash

Reputation: 86097

Yes.

Assuming you've started rails with:

rails s --debugger

and got a line in your code:

debugger

then, when you hit that breakpoint, just press:

Enter 

to step through code line-by-line. You will also see Ruby code being executed en route as your app is being parsed. Not sure how you switch that off.

Upvotes: 4

bragboy
bragboy

Reputation: 35542

Of course you can. All you have to do is install Netbeans 6.9. It has a fastdebugger inbuilt in it. You should start the server in Debug mode. You can then set breakpoints in your code and step and inspect line by line.

Upvotes: 2

Related Questions