Call a method once per page request

Hi,

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.