Where to initialize constants

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.)

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

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.