Ruby Screenshot of the Week #11: Rails Debugging
By Tor Norbye on May 18, 2007
First the screenshot - click for full resolution:
The NetBeans Ruby support now lets you debug Rails applications. As the screenshot shows, you can even step right through RHTML files! All the usual debugging features are there - breakpoints, stack view, local variables view - and balloon evaluation, where you hover the mouse over a variable and it displays the current value as a tooltip.
I can't take any credit for this; the debugger has been written by Martin Krauskopf, and uses the debug-commons library. Martin was my co-speaker for the Ruby talk (TS-9972) at JavaOne. If you missed it, Brian Leonard will be doing the same talk at RailsConf this weekend. One thing I want to clarify is that not everything I talked about in the type inference section is actually implemented yet in NetBeans. The talk represents everything I plan to do, not everything I've already done.
Note that the RHTML debugging feature is not present in the recent Milestone 9 bits. We've made a lot of improvements since then. Just this morning I integrated various fixes to make code completion work much better in Rails. You now properly get code completion in your model and migration files etc - as the following screenshot shows:
Another feature we added after Milestone 9 was some preliminary support for Auto Test - see the testing page for some screenshots and more info.
For now, I recommend that you use NetBeans Milestone 9 as your base IDE, and then use the trunk/daily Ruby bits with them. The easiest way to do that is to install Milestone 9, then follow the instructions in the RubyInstallation wiki page to blow away the
ruby1 cluster in your M9 installation and replace it with a .zip download from deadlock.nbextras.org. Also be sure to nuke your userdir for any custom installed modules there (usually
~/.netbeans/dev). In the future, staying up to date with the Tools | Plugins manager will be easy, but with Milestone 9, it only displays branched Milestone 9 modules, and we aren't merging and rebuilding the Ruby stuff into the M9 branch at this point.
If all that sounded complicated, just go and download the Ruby-only IDE zip here. Get the zip containing
rubyide in the name, unzip somewhere, and run nbrubyide/bin/nbrubyide. This will be daily-everything as opposed to a stable IDE + trunk Ruby, but - it will probably be okay.
Finally, if you're going to be debugging, make sure you first visit the RubyDebugging wiki page which will tell you some really important configuration information - like how to enable fast debugging.