CirclingMinds

July 10, 2008

How to debug a Merb Application

Filed under: Merb — Tags: — shovan @ 6:45 pm

Merb provides the “debugger” method which makes debugging easy. Insert “debugger” in the code that you want to debug. For example:

1
2
3
4
5
6
def update
   debugger # add this line
   cool_songs = Song.find_the_cool_ones
   cool_songs.reset_new_additions
   ...
end

Next start the app in debug mode:

merb -D

Now you can step through the debugger terminal and use the various available commands to debug your code. Type ‘help’ at the terminal to get a list of available commands.

(rdb:3) help
help
ruby-debug help v0.10.1
Type 'help ' for help on a specific command
 
Available commands:
backtrace  delete   enable  help    next  quit     show    trace
break      disable  eval    info    p     reload   source  undisplay
catch      display  exit    irb     pp    restart  step    up
condition  down     finish  list    ps    save     thread  var
continue   edit     frame   method  putl  set      tmate   where

Powered by WordPress