zer0halo wrote:
Where is the best place to initialize global constants that one would like
to access from both controllers and models? Initializing them in
application.rb doesn’t seem to do the trick. (I could use a before_filter
that initializes them, but I would only want it to be called once rather
than re-initialize them every single time any method in my application is
called.)
I stuck them in a “helper” style module in lib/
So we might have a choice between
- no constants
- wrap them in a block that disables the warning
- put them in lib/ and bouce the server when they change
–
Phlip
http://c2.com/cgi/wiki?ZeekLand ← NOT a blog!!
François Montel wrote:
Where is the best place to initialize global constants that one would
like
to access from both controllers and models? Initializing them in
application.rb doesn’t seem to do the trick. (I could use a
before_filter
that initializes them, but I would only want it to be called once rather
than re-initialize them every single time any method in my application
is
called.)
“Impossible is nothing.”
Are these global constants not like configuration items? Then it would
make sense to define them in config/environment.rb (or load a file with
their values from there)
Stephan
On 12/4/06, Stephan W. [email protected] wrote:
Are these global constants not like configuration items? Then it would
make sense to define them in config/environment.rb (or load a file with
their values from there)
No, they’re not configuration items, but rather shortcuts for certain
values that I use often throughout the app (like global vars). However,
you’re right, loading a file in environment.rb is probably the way to go
- I
hadn’t even thought of that. I’ll give it a try. Thanks.
–
“Impossible is nothing.”