Topic: Active Record Cache

So, I've got an active record object which has some fairly difficult to compute derived attributes - what's the best way to keep some sort of cache of this data structure which only gets refreshed if the database for that model is changed?

Re: Active Record Cache

You could try the ||= method. This only helps you within the same request cycle though.

def expensive_method
  @result ||= do expensive calculation
It's not the size of the app that matters, it's how you code it. ~ railsenvy