I'm attempting to use action caching to cache an action after which by hand expire it using another action known as refresh. I understand the Rails best practice is by using a sweeper but that does not work either. This is effective in your area with WebBrick however when I deploy to Apache using Phusion Passenger, I am unable to obtain the cache to run out. It seems that expire_action is expiring the incorrect action by omitting index in the cache path.


class BillsController < ApplicationController
  caches_action :index

def index

def refresh
  expire_action :action => :index
  redirect_to :action => :index

After I navigate to http://www.mysite.org/bills, /log/production.log shows this:

Started GET "/bills"
Rendered bills/index.html.erb
Write fragment views/www.mysite.org/bills/index

When I navigate to http://www.mysite.org/refresh, /log/production.log shows this:

Started GET "/bills/refresh" 
Expire fragment views/www.mysite.org/bills   <<<<Culprit?
Redirected to http://www.mysite.org/bills
Started GET "/bills"
Read fragment views/www.mysite.org/bills/index

Observe that Expire fragment sights/www.mysite.org/bills doesn't range from the /index portion. I suspect because of this , the cache isn't expiring but I don't know.

My apache config for that site appears like this:

<VirtualHost *:80>
      ServerName www.mysite.org
      DocumentRoot /var/www/html/mysite.org/public
      <Directory /var/www/html/mysite.org/public>
         AllowOverride all
         Options -MultiViews