Debugging Rails with Netbeans
Development, Ruby on Rails July 15th, 2008
Here’s how you can setup debugging with your Ruby environment using Netbeans 6.1. Netbeans 6.1 comes with a debugger installed, but only with JRuby, this is how to set it up to work with Ruby.
Due to a bug with Netbeans 6.1 you must have the following versions of gems installed:
- ruby-debug-ide 0.1.10
- ruby-debug-base 0.10.0
This bug will be resolved in Netbeans 6.5, to allow support for newer versions of the gems.
Install the required gems
Install the two gems via gem command:
gem install ruby-debug-ide -v 0.1.10 gem install ruby-debug-base -v 0.10.0 |
If you need to uninstall newer versions of the gems, you can uninstall by:
gem uninstall ruby-debug-ide -v 0.2.0 gem uninstall ruby-debug-base -v 0.10.1 |
Once installed, when you open up Netbeans goto, Tools -> Ruby Platforms in the menu and select click Autodetect Platforms. Your screen should look similar to this: (Note: MacOSX setup)

Inserting a Break Point
You can insert break points in your Ruby code and in your views. You can simply add one by clicking the line number on the left side of the line of code you wish the debugger to stop.
Debug Your File
Simply right-click your code and select Debug “<filename>”.

Your default browser should attempt to load the page, and if you go back into Netbeans you can see information about the break point and the current local variables at the break point.

Debug Toolbar
You have access to your normal debug functions such as Step In/Out, Continue etc, via the Netbeans Debug toolbar.
July 16th, 2008 at 8:51 pm
Hi,
My name is James Branam and I’m the NetBeans Community Docs Manager. Your blog entry would make a fantastic tutorial entry for our Community Docs wiki (http://wiki.netbeans.org//CommunityDocs). Would you be willing to contribute it? If you need any help or have any questions, please contact me at james.branam@sun.com. I look forward to hearing from you.