Posts Tagged ‘Rails ruby-debug debugging’

ruby-debug saved me some time today

Thursday, February 7th, 2008

I’m probably late to the party, but I just discovered Rails 2.0’s debugger and it’s pretty rad. Basically you do:

1. sudo gem install ruby-debug

and then you

2. put a ‘debugger’ statement somewhere in your controllers or models, as a breakpoint


def add_comment
debugger
...

3. start the server with the debug flag

script/server -u

4. Go to the appropriate page in the browser and when the “debugger” statement is executed it’ll break and you’ll be able to evaluate local vars, etc.

(rdb:9) self.class.name
"Shopperview::RequestController"
(rdb:6) request.request_uri
"/request/create"
(rdb:6) request.request_method
:post
(rdb:6) request.path
"/request/create"