I've got problem with simple caching (ruby 1.9.2, rails 3.1.3, development environment):
development.rb:
config.action_controller.perform_caching = true
config.action_controller.cache_store = :file_store, 'tmp/cache'
config.action_controller.page_cache_directory = 'public/cache'
sweeper:
class CacheSweeper < ActionController::Caching::Sweeper
observe Article, Photo, Advertisement
def after_save(record)
expire_home
end
...
private
...
def expire_home
expire_page(:controller => '/homes', :action => 'index')
end
end
controllers:
class HomeController < ApplicationController
caches_page :index
cache_sweeper :cache_sweeper
def index
....
Pages are cached in right directory and actions triggers sweeper actions as they should, but pages are not expired and server is trying to get cached pages from default place.
cache: [GET /] miss
Any ideas why? Is there something wrong with my configuration?
You have the wrong controller name and leading slash. Try the following: