Displaying 1 result from an estimated 1 matches for "invalidate_feature_typ".
Did you mean:
invalidate_feature_types
2006 Apr 28
0
Model caching for pseudo-constant globals
...finition 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
def invalidate_globals
Globals.invalidate_feature_types
end
This would rely on a definition like this in Globals:
def Globals.invalidate_feature_types
@feature_types = nil
end
This kind of thing is pretty common in the J2EE world, where I come
from.
I''ve tried doing this myself, with spectacularly confusing results.
Everything...