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
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
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
=> 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