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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eb96620826312516bb4a2d6deeee6688?d=identicon&s=25 Jean-Christophe Michel (Guest)
on 2005-12-24 21:27
(Received via mailing list)
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 Michel
This topic is locked and can not be replied to.