Forum: Ruby on Rails Debugging advice

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
73c04e9ef9ca435c5b19a2e765ae6d20?d=identicon&s=25 Max Williams (max-williams)
on 2007-08-01 18:50
Can anyone recommend a nice way to debug a rails app, ie to step through
the code, seeing what all the local values are as we go along?  Is there
any IDE support?  I'm a windows xp user.  thanks...
0ab6a5abab167b409f58d280dc59a229?d=identicon&s=25 Faisal N Jawdat (Guest)
on 2007-08-01 18:58
(Received via mailing list)
On Aug 1, 2007, at 12:50 PM, Max Williams wrote:
> Can anyone recommend a nice way to debug a rails app, ie to step
> through the code, seeing what all the local values are as we go
> along?  Is there any IDE support?  I'm a windows xp user.  thanks...

http://www.google.com/search?q=debug+rails+app

http://www.google.com/search?q=debug+rails+app+ide

-faisal
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2007-08-01 19:00
(Received via mailing list)
ruby-debug

On 8/1/07, Max Williams <rails-mailing-list@andreas-s.net> wrote:
>
> Can anyone recommend a nice way to debug a rails app, ie to step through
> the code, seeing what all the local values are as we go along?  Is there
> any IDE support?  I'm a windows xp user.  thanks...
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


--
Cheers!
- Pratik
http://m.onkey.org
73c04e9ef9ca435c5b19a2e765ae6d20?d=identicon&s=25 Max Williams (max-williams)
on 2007-08-02 10:41
Faisal N Jawdat wrote:
> On Aug 1, 2007, at 12:50 PM, Max Williams wrote:
>> Can anyone recommend a nice way to debug a rails app, ie to step
>> through the code, seeing what all the local values are as we go
>> along?  Is there any IDE support?  I'm a windows xp user.  thanks...
>
> http://www.google.com/search?q=debug+rails+app
>
> http://www.google.com/search?q=debug+rails+app+ide
>
> -faisal

I know that google is my friend etc, i was hoping for a recommendation
of a particular IDE?  Anyone?

Thanks anyway, don't mean to sound ungrateful :)
E91518f050cb6081186ff461950099e0?d=identicon&s=25 Luis Villegas (vilec)
on 2007-08-02 10:46
(Received via mailing list)
Yep. Download last eclipse basic edition. Eclipse Europe
Then download radrails plugin in www.aptana.org

Create a new server in debug mode with your existing rails app and you
will
have debugging options (breakpoints, watch variables...)
73c04e9ef9ca435c5b19a2e765ae6d20?d=identicon&s=25 Max Williams (max-williams)
on 2007-08-02 11:06
Luis Villegas wrote:
> Yep. Download last eclipse basic edition. Eclipse Europe
> Then download radrails plugin in www.aptana.org
>
> Create a new server in debug mode with your existing rails app and you
> will
> have debugging options (breakpoints, watch variables...)

Thanks for the advice Luis - another question for you: Eclipse seems to
have a few different versions - do i just get the latest Eclipse "Java
Developers" edition?  looking at the Europa "21 projects" list and
feeling a bit unsure.

cheers
E91518f050cb6081186ff461950099e0?d=identicon&s=25 Luis Villegas (vilec)
on 2007-08-02 11:19
(Received via mailing list)
Sorry I told you basic edition. I meant Classic Edition.
73c04e9ef9ca435c5b19a2e765ae6d20?d=identicon&s=25 Max Williams (max-williams)
on 2007-08-02 11:29
Max Williams wrote:
> Luis Villegas wrote:
>> Yep. Download last eclipse basic edition. Eclipse Europe
>> Then download radrails plugin in www.aptana.org
>>
>> Create a new server in debug mode with your existing rails app and you
>> will
>> have debugging options (breakpoints, watch variables...)
>
> Thanks for the advice Luis - another question for you: Eclipse seems to
> have a few different versions - do i just get the latest Eclipse "Java
> Developers" edition?  looking at the Europa "21 projects" list and
> feeling a bit unsure.
>
> cheers

Never mind!  Found all the installation instructions on the aptana site.
cheers! :)
E9cbfb803f4aa9eeeece6a3806a3eaec?d=identicon&s=25 Anthony Richardson (Guest)
on 2007-08-02 12:30
(Received via mailing list)
Max Williams wrote:
> I know that google is my friend etc, i was hoping for a recommendation
> of a particular IDE?  Anyone?
>
The beta version of NetBeans 6.0 is free, open source and has great Ruby
on Rails support. For Ruby specifc build see
http://wiki.netbeans.org/wiki/view/Ruby it supports breakpoint
debugging, code completion etc.... For screen shots and examples check
out the developers blog at http://blogs.sun.com/tor/

I prefer NetBeans over Eclipse (although Eclipse is certainly good) so
make sure you try them both. Either way the IDE environment fro Ruby and
specifically Rails is improving in leaps and bounds at a rapid pace.

Cheers,

Anthony
36feb4959db6ab8259a44962f0fa761f?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-08-02 12:55
(Received via mailing list)
On Wed, Aug 01, 2007 at 06:50:52PM +0200, Max Williams wrote:
>
> Can anyone recommend a nice way to debug a rails app, ie to step through
> the code, seeing what all the local values are as we go along?  Is there
> any IDE support?  I'm a windows xp user.  thanks...

By far the nicest way to debug a rails app is to write more Tests :-)

You really should not need to step through your code with a debugger
since your test cases should show you where the bug is. Just do in your
unit/functional tests what you would otherwise do manually in your
debugging UI - compare the real values of variables to what you would
expect them to be.


cheers,
Jens

--
Jens Krämer
http://www.jkraemer.net/ - Blog
http://www.omdb.org/     - The new free film database
E9cbfb803f4aa9eeeece6a3806a3eaec?d=identicon&s=25 Anthony Richardson (Guest)
on 2007-08-03 05:23
(Received via mailing list)
Jens Kraemer wrote:
> By far the nicest way to debug a rails app is to write more Tests :-)
> You really should not need to step through your code with a debugger
> since your test cases should show you where the bug is. Just do in your
> unit/functional tests what you would otherwise do manually in your
> debugging UI - compare the real values of variables to what you would
> expect them to be.
>
I must admit to never have used the debugger for tracking down a bug, I
find the stack dump or development log to contain the information
required (so far). What I find the debugger great for is just learning
how rails works better, nothing like stepping through the code as it
runs to see what is happening.

-- Anthony
09df4bc01fb62f1c71041caf63e1e640?d=identicon&s=25 Procrastinx (Guest)
on 2007-08-03 07:24
(Received via mailing list)
On Aug 2, 3:54 pm, Jens Kraemer <j...@jkraemer.net> wrote:
> unit/functional tests what you would otherwise do manually in your
> debugging UI - compare the real values of variables to what you would
> expect them to be.

That is the best piece of advice IMO. Though others have pointed out
that debugging is good way to learn the flow  etc.
the real practical advice is to have a thorough coverage of test cases
for the entire application.

--
Procrastinx
04952a6ee948f345e9c3727850d09a1b?d=identicon&s=25 dima (Guest)
on 2007-08-03 08:37
(Received via mailing list)
Debugging and unit testing are to different methods to achieve more
flawless application.

The unit testing can be expressed like snapshot checking.
You bring your app in some state, than take a snapshot and compare the
snapshot taken with expected one.
Debugging is more like flow checking. You start your ride at some
point of execution and enjoy, more or less, the way your program is
taking you.

Both techniques are required.
The unit testing will tell you if your program is on the right state
on every checkpoint.
Debugger can find the paths that are not covered by unit testing.

Since this is about the IDE, I personally use Eclipse (Europa) with
Aptana using rails-debug.
Some times it is convenient to debug from console but it's up to you.

End for the closing it is essential to learn to read the log files and
to use logging as much as possible since some issues are hard to
reproduce.
This topic is locked and can not be replied to.