From: Richard Date: 2006-12-02T13:45:07+09:00 Subject: Re: Is there a simply way to get every method log itself before running? Hi Bill, I checked out the filter, and I see that I could create MyMainController derived from ActionController::Base and have all my controllers subclass MyMainController. That would allow me log the name of subcontrollers and the state of some object before any methods of those controllers is invoked, and likewise when the controllers are closed. But I don't see how I could get any of the methods of those controllers to report that they had been invoked and subsequently terminated. In addition, I didn't see a corresponding mechanism for views and helpers. Do you agree, or is my assessment simplistic? Regards, Richard bill walton wrote: > Hi Richard, > > Richard wrote: > > I'd like to write a trace function and have every method > > execute that trace when the method's invoked. In that > > trace function, I'd like to be able, e.g. to write the > > invoked method's name, perhaps more. > > > > Is there an easy way to do that? > > > > BTW, I posted this question on the Ruby/Rails Newsgroup > > before Irealized it's more appropriate here. > > Since you mentioned Rails, I'll assume you're using it. If not, this > won't apply. > > Check out the Class documentation ( http://api.rubyonrails.org , left > panel, middle section) for ActionController::Filters::ClassMethods. > You're probably looking for an after_filter given that you may want to > store some stuff you 'compute' in the method. > > hth, > Bill