Displaying 1 result from an estimated 1 matches for "feature_typ".
Did you mean:
feature_types
2006 Apr 28
0
Model caching for pseudo-constant globals
...ype, Feature,
Country and SwearWord.
They''re ActiveRecord subclasses, backed by the database, so that they''re
easy for administrators to edit.
Is there a sane way to implement model caching for these, such that I
can do stuff like this in my controllers and models:
Globals.feature_types.each {...}
This would rely on a definition like this in Globals:
def Globals.feature_types
@feature_types ||= FeatureType.find(...)
end
Then I could use after_save and after_update filters on FeatureType and
friends to invalidate the cache like this:
after_save :invalidate_globals...