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

Hi,

Put it at application controller.

Regards

On Jan 17, 2008 3:27 PM, Vinicius Cubas B. [email protected]
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

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?

put it inside a before_filter or after_filter

http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html

on application controller

before_filter :my_method

private
def my_method
do_something
end

Regards,

On Jan 17, 2008 4:02 PM, Vinicius Cubas B. [email protected]
wrote:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs