title: Rails Fragment Cache Won't Expire
body: <p>I'm using fragment caching in my 3.1. Rails app and have one fragment that isn't expiring and I don't know why.  It's a fragment that I want to expire based on time (every hour).  I'm on Heroku, using the Memcachier Add-on for my caching.  I don't seem to have any other caching issues.</p>
  
  <p>In my app, there are three models: User, Community, and Activity.  On the Community#index, there is a fragment that shows Activity by Users in this Community that I want to expire hourly.  The calculation, which is a method in the Activity model, works fine - it's just that the fragment is expiring hourly (and refreshing).</p>
  
  <p>In my view, I have:</p>
  
  <pre><code>&lt;% cache("activity_#{community.id}", :expires_in =&gt; 1.hour) do %&gt;               
      &lt;-- content &gt;      
  &lt;% end %&gt;
  </code></pre>
  
  <p>I've also tried making it a scheduled task, by adding an expiration for the cache in the User model.</p>
  
  <pre><code>  def self.expire_activity
      Community.find_each do |community|
        ActionController::Base.new.expire_fragment('activity_#{community.id}')
      end
    end
  </code></pre>
  
  <p>I tried to follow the answer to this <a href="https://stackoverflow.com/questions/393395/how-to-call-expire-fragment-from-rails-observer-model">question</a> to determine how to expire the cache from a model, but with this this code, I get the error: </p>
  
  <p><code>NoMethodError: undefine method 'expire_fragment' for #&lt;Class:0x5ffc3e8&gt;</code></p>