I'm trying to do some fragment caching.
And to clear the cache whenever some objects are
created/updated.
However it seems cache_sweeper doesn't works as we'd expect it
to.
In my controller I have :
class PagesController < ApplicationController
cache_sweeper :page_sweeper, :only => [:create, :update, :destroy]
And in my sweeper :
class PageSweeper < ActionController::Caching::Sweeper
observe Page
def after_save(page)
expire_cache_for(page)
end
def after_destroy(page)
expire_cache_for(page)
end
private
def expire_cache_for(page)
expire_fragment("page_#{post.id}")
end
end
Then when a sweeping cache action is called, I get only a blank
page without anything in the log.
Started POST "/me/pages" for 127.0.0.1 at 2010-05-12 17:35:10