I have arrived at the following idiom for caching certain expensive
computations on ActiveRecord subclasses:
def expensive
@expensive = hairy_database_query_or_something
end
def reload
@expensive = nil
super
end
It works, but I’m vaguely unhappy about it. Is there a better way?