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