Does anyone know of a good way of caching the constant variables in
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.
On Aug 12, 10:52 pm, tispratik [email protected] wrote:
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.