I want to initialize a giant hash on application startup, and have a
controller interact with that hash WITHOUT having to rebuild the hash
for every single request. Generating the hash will be a bit time
consuming, so I want it built and immutable as soon as I launch the
server.
Create an initializer. Rails will load any file you dump in RAILS_ROOT/
config/initializers/ when the server starts. That, I believe, would be
the most "rails way"-ish way.
-Danimal
P.S. Back in the early Rails days, I used to drop a lot of
initialization stuff at the end of environments.rb, i.e. custom date
displays, reference values, global constants, etc. Now I put 'em in an
initializer... just better organized, IMHO.