October 2007
Intermediate to advanced
58 pages
59m
English
Even though strace, lsof, and friends are powerful tools, most of the time you should not start with them. This section is a brief recap of the techniques typically used to troubleshoot a problem with a Ruby process.
raise, puts, and debug()Without a doubt, the most popular way to investigate an unexpected behavior in a Ruby program is to add a raise some_object.inspect statement or a puts some_object.inspect statement in the code and rerun the same test or use case. Quick and dirty...and terribly efficient (especially the raise version: It is easy to spot, and you won’t forget to remove it).
Rails has a variant for HTML rendering in a view: the debug() function. This function outputs the ...