Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 880
Nathan Long Avatar asked Nov 10 '10 07:11

Nathan Long


2 Answers

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

like image 145
byterussian Avatar answered Sep 28 '22 04:09

byterussian


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.

like image 42
Snowcrash Avatar answered Sep 28 '22 05:09

Snowcrash