Forum: Ruby on Rails call a method once per page request

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Jean-Christophe M. (Guest)
on 2005-12-24 22:27
(Received via mailing list)

I'm trying to find how to have a method called once per page request.
Having a before_filter in ApplicationController leads to many calls when
I use render_component.

Another thing I didn't found is: how to use a constant or a method in
routes ? To respect DRY, I want to introduce a constant in routes (as a
regexp to test my :lang param that is present in all routes), or call a
method of a singleton object.
I tried to define either a constant or a singleton obj in
environment.rb, but when used in routes, I get
NameError, uninitialized constant Regex

Thks for helping

Jean-Christophe M.
This topic is locked and can not be replied to.