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, ...
Get Learning Rails now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.