O'Reilly logo

Learning Rails by Edd Dumbill, Simon St. Laurent

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Ruby Debugger

The console is fun for tinkering and can be extremely useful for trying things out, but it’s a completely separate process from the way you (and your users) normally run Rails applications.

Note

Unfortunately, Heroku does not appear to support the Ruby debugger at the time of writing. Hopefully it will appear eventually.

If you do a search on Rails debugging, you’ll find lots of information on the Rails breakpointer. Unfortunately, the breakpointer depended on a bug in Ruby itself, one that was fixed in Ruby 1.8.5, so the breakpointer is now defunct. Instead, the most common current approach uses the Ruby debugger. It’s installed as a gem called ruby-debug. From the command line, you can install it with:

$ sudo gem install ruby-debug
Password:
Building native extensions.  This could take a while...
Building native extensions.  This could take a while...
Successfully installed linecache-0.43
Successfully installed ruby-debug-base-0.10.1
Successfully installed ruby-debug-0.10.1
3 gems installed
Installing ri documentation for linecache-0.43...
Installing ri documentation for ruby-debug-base-0.10.1...
Installing ri documentation for ruby-debug-0.10.1...
Installing RDoc documentation for linecache-0.43...
Installing RDoc documentation for ruby-debug-base-0.10.1...
Installing RDoc documentation for ruby-debug-0.10.1...

If you’re on Windows or certain Linux installs, the sudo part may be unnecessary.

Note

If you get a “Can’t find header files for ruby” error message, your Ruby ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required