Vinicius Cubas Brand
2008-Jan-17 18:27 UTC
How to put a method to execute in every page view?
Hello. I want to execute a method in every page view, in my Rails application. It will be for a customized log plugin. So, how do I do that and where is the proper place to put the method call? thank you --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rafael Mueller
2008-Jan-17 18:42 UTC
Re: How to put a method to execute in every page view?
Hi, Put it at application controller. Regards On Jan 17, 2008 3:27 PM, Vinicius Cubas Brand <viniciuscb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello. I want to execute a method in every page view, in my Rails > application. It will be for a customized log plugin. So, how do I do > that and where is the proper place to put the method call? > > thank you > > >-- Rafael Mueller http://queroseragil.wordpress.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Vinicius Cubas Brand
2008-Jan-17 19:02 UTC
Re: How to put a method to execute in every page view?
ok, inside which method in application controller? Is there some method in application controller that is executed in every page view? Does the dispatcher executes the application controller when it starts, or does it executes directly the requested controller in the url? On 17 jan, 16:42, "Rafael Mueller" <mueller...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Put it at application controller. > > Regards > > On Jan 17, 2008 3:27 PM, Vinicius Cubas Brand <viniciu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hello. I want to execute a method in every page view, in my Rails > > application. It will be for a customized log plugin. So, how do I do > > that and where is the proper place to put the method call? > > > thank you > > -- > Rafael Muellerhttp://queroseragil.wordpress.com--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rafael Mueller
2008-Jan-17 19:11 UTC
Re: How to put a method to execute in every page view?
put it inside a before_filter or after_filter http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html on application controller <code> before_filter :my_method private def my_method do_something end </code> Regards, On Jan 17, 2008 4:02 PM, Vinicius Cubas Brand <viniciuscb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > ok, inside which method in application controller? > > Is there some method in application controller that is executed in > every page view? Does the dispatcher executes the application > controller when it starts, or does it executes directly the requested > controller in the url? > > On 17 jan, 16:42, "Rafael Mueller" <mueller...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > > > Put it at application controller. > > > > Regards > > > > On Jan 17, 2008 3:27 PM, Vinicius Cubas Brand <viniciu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > > > > > Hello. I want to execute a method in every page view, in my Rails > > > application. It will be for a customized log plugin. So, how do I do > > > that and where is the proper place to put the method call? > > > > > thank you > > > > -- > > Rafael Muellerhttp://queroseragil.wordpress.com > > >-- Rafael Mueller http://queroseragil.wordpress.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---