How to debug Rails app?

I have spent last few days (in Poland May 1st and 3rd are holidays, so early May is always a long weekend here :)) ) reading Pragmatic series and trying to understand Ruby on Rails…

My first concerns are troubles (at least I’ve encountered some, maybe I don’t know something) with debugging and documentation.

Auto-generated docs for Rails are quite good, but navigation and finding right information makes trouble. They are divided into docs generated to each part of rails (like actionpack, activerecord, etc..) I’m new to rails and thus I’m not sure whether to check actionpack or activesupport or other part of rails docs. But dealing with it was quite easy. And Google desktop was not needed ;-)) swish (http://swish-e.org/) is quite enough for me.

After having indexed all docs ;)) with Agile Web Development with Rails and Programming Ruby opened I’ve started to learn more. But then I needed sometimes to debug my application. Yeah, I’ve learned to use breakpoints, but breakpoints, however very handy have lack of one feature. Coming from compiled languages world I’m used to step and next commands in gdb. I don’t know way to use breakpoints, examine application state and step through application. Of course it is possible to put breakpoints in almost every interesting place, but this is both error prone and not effective.

I tried to be smart :))) and run require 'debug' directive in irb shell after connecting to application with breakpoint… Guess what? :))) whole thing (rails) hung… Bad luck… I’m pretty sure, there must be some way to do such thing!

Join the Conversation

3 Comments

  1. Proper test coverage should reduce a need to debug your application. The question is: how good is your test suite? ;)

  2. Should. And probably do.

    But this is my start with Rails. Even more – it is my start with some real framework (I mean – automated test, deployment, etc) since I’m mainly network engineer, not developer. OK. Probably I’m ‘wanabedeveloper’ :)))

    So – such feature would be handy to lower entry barrier. It is easy to do 4Days but step further is quite hard when on your own – without somebody you can ask, or code you can browse as an example. Koders.com does not have much in context of ruby/rails…

  3. Hi,

    I’ve gotten Eclipse to function as a full in-line debugger for Rails. So you can point your webbrowser at a Webrick server running inside Eclipse and breakpoint at any point in the entire Rails stack. It’s method right now is a little crude, but the function appears to be complete. Here’s my write up:

    http://www.misuse.org/cms/article.php?story=20060913182223765

    Drop me a line if you find this useful!

    Steve

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.