Read my latest article: 8 things I look for in a Ruby on Rails app (posted Thu, 06 Jul 2017 16:59:00 GMT)

Request for Rails Debugging Tools

Posted by Tue, 10 Jan 2006 01:30:00 GMT

16 comments Latest by online blackjack Wed, 30 Aug 2006 19:28:35 GMT

Howdy partners!

I hereby have a proposition for you all. Besides using breakpoint for debugging your Rails applications what other tools do you use? When I say debugging... I mean… tracking down problems and issues in your application that your tests just aren’t identifying.

Inquiring minds want to know. :-)

Debugging RoundUp!

Post comments with information and links… and I’ll roundup responses and see if I can review a few options in another blog entry.

Thanks in advance!

YeeHaw!

Get help with your Rails project

comments powered by Disqus
Comments

Leave a response

  1. Avatar
    Peat Tue, 10 Jan 2006 01:38:11 GMT

    raise ... pretty darned handy, especially if used like:

    raise my_foo.inspect

    logger.debug ... although it’s good to do something like:

    logger.debug '### blah blah'

    ... so that I can:

    tail -f log/development.log | grep '###'

    And, of course, there’s always the marvelous:

    ./script/console

    ... for when I need something a little more interactive.

  2. Avatar
    rick Tue, 10 Jan 2006 01:57:15 GMT

    Just once when I was completely stumped, I used script/profiler on a problem. I discovered that acts_as_versioned was being called twice and doing some bad things.

    script/profiler ‘Foo.new’

    That shows you all the methods being called to instantiate that object, leaving out all the rails initialization stuff.

  3. Avatar
    jr Tue, 10 Jan 2006 01:59:09 GMT

    ummm, more tests :)

  4. Avatar
    Julias Shaw Tue, 10 Jan 2006 02:04:02 GMT

    ummm, more tests :)

    Sometimes TestUnit, sometimes JSUnit, sometimes, Selenium, and once in a while Watir, but always more automated tests.

    Otherwise the problem may pop up again and I could miss it.

  5. Avatar
    Tom Lockney Tue, 10 Jan 2006 02:47:18 GMT

    Three words: simplify, simplify, simplify.

    Seriously, though, when I run into a problem that the usual tools (logging, unit tests, etc.) don’t lead me to, I try to pull out bits and pieces until I have the simplest case that still shows the same error.

    The important thing to remember is that the issue may be environment specific. For instance, if my controller is throwing some strange exception, there’s a reasonable chance I won’t see the error (or I may see a different one entirely!) if I try running the code in script/console.

  6. Avatar
    brasten Tue, 10 Jan 2006 03:40:44 GMT

    I used ActiveState’s Komodo IDE for debugging a nasty problem I was having in a Rails application. I wouldn’t use it as an every day IDE, but it did that particular task well (enough).

  7. Avatar
    Jeremy Voorhis Tue, 10 Jan 2006 03:44:37 GMT

    First, write good unit tests for your models and libraries. Once you feel confident in those tests, you may write functional tests. Write as many of these as you feel motivated to, even for trivial things. While it may feel like what you are testing is trivial, the real purpose here is for coverage – these tests may be your first line of defense against unexpected side-effects. In some cases, it makes sense to separate your tests for GET and POST.

    When you fix a bug, be sure to write a test first. This should help you prevent it from cropping up again.

    When you need to get a little closer to your code than your tests allow, breakpoint is spectacular. Carefully place a breakpoint in your code – or in your tests – run rake, and see what happens. If you are feeling intrepid, you may place one in an ERb template as well.

    tail -f log/development.log is invaluable, especially when SQL may be at fault.

    Peat is really smart. Take his logger and grep advice.

    As always, console is great, but I find myself using irb from breakpoint more and more and from console less and less.

  8. Avatar
    Jean Tue, 10 Jan 2006 04:16:19 GMT

    RDT (ruby plugin for eclipse) offers a debugger service based on debug.rb.

    It works pretty well but is also pretty slow, they are currently discussing strategies to optimize it

  9. Avatar
    Steven A Bristol Tue, 10 Jan 2006 10:19:50 GMT

    I use Arachno Ruby for development and debugging. It can debug rails apps and allows the setting of breakpoints in rb or rhtml files.

    http://www.ruby-ide.com

  10. Avatar
    Marc Tremblay Tue, 10 Jan 2006 12:10:42 GMT

    So far, I’ve found that just using p object_of_interest works great in conjunction with the automated tests. No need to grep anything as it’s not burried in a log.

    If you don’t have a test to demonstrate a bug, then there is no bug. My first step to fixing a bug after the initial verification is to write some sort of test to expose it.

  11. Avatar
    Robby Russell Tue, 10 Jan 2006 14:05:28 GMT Recommend me on Working with Rails

    Thanks guys! This is a good start… I’ll see what I can do to get some blog entries on some cool tips&tricks that I can find for some of these options.

  12. Avatar
    RyanA Thu, 12 Jan 2006 21:08:52 GMT

    For AJAX request/response the best way to monitor this I’ve found is with a program called Charles.

    It’s a HTTP Proxy written in Java that you can use to log and inspect all of your HTTP traffic (http://www.xk72.com/charles).

    I discovered it back in my Macromedia Flash days… shudder

    It’s good debugging! It’s not free though, $50 USD :(

    Worth the money though if you spend 2 hours tracking down a problem that you could have worked out in a few minutes!

  13. Avatar
    Marc Tremblay Fri, 13 Jan 2006 11:42:23 GMT

    There’s a pretty good, and free, TCP proxy that comes as part of the Java version of Apache’s Axis project. I’ve used it for years and it works quite well.

  14. online casino strategies Tue, 15 Aug 2006 14:19:19 GMT

    It’s federal to be flailed! One steep lasvegas on line casino smiled a road merrily. Domestic las vegas slot machines is the clever las vegas. Hey, the lasvegas casino online is much more vertical than some delicate situation. That las vegas wagering is sincerely retail.

  15. Slots online Sun, 20 Aug 2006 14:31:21 GMT

    The visual kind strove because of that extreme lot. A nuclear act checked one life robustly. Hey, one expensive method pleasantly bore via that whole family. I was that night considering one school. Medical wall is the conscious casino fun.

  16. online blackjack Wed, 30 Aug 2006 19:28:35 GMT

    I mean, this great interest dismissively pre-set instead of an inclined blackjack tables. It’s pretty to be dropped! This eager process browbeat alongside a difficult boy. Some loyal blackjack 21 lighted the blackjack truly. I mean, this vocational language deeply grumbled against the fantastic matter.