# Tracing the calls and classes

**URL:** <https://www.ruby-forum.com/t/tracing-the-calls-and-classes/86642>\
**Category:** Rails\
**Created:** [February 23, 2007, 11:47pm UTC](https://www.ruby-forum.com/t/tracing-the-calls-and-classes/86642 "2007-02-23T23:47:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![antonaylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@antonaylward](https://www.ruby-forum.com/u/antonaylward)\
**Post date:** [February 23, 2007, 11:47pm UTC](https://www.ruby-forum.com/t/tracing-the-calls-and-classes/86642/1 "2007-02-23T23:47:17Z")

</div>

Is there any way, short of lot of log statements, to trace the execution  
of  
rails code? Th reason I’m asking has to do with name space, inheritance  
and  
over-riding functions.

I’m preprocessing text before handing it to Redcloth so I have

```
 @text_to_render = MyRender.new( @text.to_s )

```

and

class MyRender

…  
def render(…)  
…  
end  
…  
end

Not I know what

```
    @text_to_render.render

```

refers to 🙂  
but what is and isn’t over-ridden?  
If I use any of the depreciated Rails ‘render\_’ family that eventually  
calls  
‘render()’ will this over-ride them? Will it only NOT over-ride them if  
I  
invoke it with a MyRender class object

```
    @text_to_render.render( :action => ....

```

and  
render( :action =\> …

Or, to ask it another way. How can I override the Rails render and do a

```
   def render( @args )
 ... do my stuff ...
 optionally call the Rails 'render'
       ... do more of my stuff
   end

```

–  
It is not wealth one asks for, but just enough to preserve one’s  
dignity, to  
work unhampered, to be generous, frank and independent.  
W. Somerset Maugham, ‘Of Human Bondage’, 1915

---

<div class="post-metadata">

**Author:** ![antonaylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@antonaylward](https://www.ruby-forum.com/u/antonaylward)\
**Post date:** [February 24, 2007, 12:00am UTC](https://www.ruby-forum.com/t/tracing-the-calls-and-classes/86642/2 "2007-02-24T00:00:18Z")

</div>

You can use ruby-debug…

Gem install ruby-debug

rdebug script\server

help

---

<div class="post-metadata">

**Author:** ![antonaylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@antonaylward](https://www.ruby-forum.com/u/antonaylward)\
**Post date:** [February 24, 2007, 12:40am UTC](https://www.ruby-forum.com/t/tracing-the-calls-and-classes/86642/3 "2007-02-24T00:40:20Z")

</div>

Oh wow!

Yes, this makes it very clear what code is executed in the controller  
and  
what code is executed in the view

Which begs the question - where’s the best place for code?  
Obviously there the app/controller and app/model but how should one  
treat  
app/helpers and /lib ??

Meech said the following on 02/23/2007 05:59 PM:

> You can use ruby-debug…
> 
> Gem install ruby-debug
> 
> rdebug script\server
> 
> help

–  
Five exclamation marks, the sure sign of an insane mind.  
– Terry Pratchett _Reaper Man_

---

<div class="post-metadata">

**Author:** ![antonaylward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb8c5e/32.png) [@antonaylward](https://www.ruby-forum.com/u/antonaylward)\
**Post date:** [February 25, 2007, 2:32am UTC](https://www.ruby-forum.com/t/tracing-the-calls-and-classes/86642/4 "2007-02-25T02:32:50Z")

</div>

Meech wrote:

> You can use ruby-debug…
> 
> Gem install ruby-debug
> 
> rdebug script\server
> 
> help

If I do this in my project directory, I get this output:

rdebug script/server  
./script/server:2: require File.dirname( **FILE** ) + ‘/…/config/boot’  
(rdb:1) help  
ruby-debug help v.0.7.5  
Available commands:  
backtrace break catch cont delete display down eval exit finish frame  
irb list method next p pp quit reload restart save script set step  
tmate trace undisplay up var where

(rdb:1)

So, rdebug is running. But I don’t get any response on localhost:3000.  
I’m running mongrel if that makes a difference. A regular invocation of  
script/server gives me:

=\> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)  
=\> Rails application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=\> Call with -d to detach  
=\> Ctrl-C to shutdown server  
\*\* Starting Mongrel listening at 0.0.0.0:3000  
\*\* Starting Rails with development environment…  
\*\* Rails loaded.  
\*\* Loading any Rails specific GemPlugins  
\*\* Signals ready. TERM =\> stop. USR2 =\> restart. INT =\> stop (no  
restart).  
\*\* Rails signals registered. HUP =\> reload (without restart). It might  
not work well.  
\*\* Mongrel available at 0.0.0.0:3000  
\*\* Use CTRL-C to stop.

Would really like to check out ruby-debug, but I’m kind of stumped on  
this.

b
