title: How to memoize a class method in Rails?
body: <p>I have a model with a class method which is heavy in computation that I call many times per request.</p>
  
  <p>Ideally i'd like to cache the result for the duration of a single request.</p>
  
  <p>What's rails best practice in this situation?</p>
  
  <p>Example:</p>
  
  <pre><code>class MyClass &lt; ActiveRecord::Base
    def self.heavy_method; ... ; end
  end
  </code></pre>
  
  <p>Then in a helper</p>
  
  <pre><code>def helper
    MyClass.heavy_method
  end
  </code></pre>
  
  <p>This helper is used in many views</p>