Caching Model Constants


Does anyone know of a good way of caching the constant variables in
the model.
I have constants in models whose values are based on finder methods.

eg) TYPE_UNIV = Decode.find_by_name("University")

When i access this constant from Controllers or Views or Model, i see
a query running in DB each time.


Are you seeing this in the development logs while browsing your site?
If so, this is because in development mode Rails reloads your models,
controllers, and views with each request. And since I assume your
setting your constants in the toplevel class definition, they'll only
be reloaded every time appropriate model.rb file gets autoloaded.