私はコントローラーを持っています:
caches_action :show
cache_sweeper :the_model_sweeper, :only => [:update, :destroy]
とスイーパー:
observe TheModel
def after_save(the_model)
expire_cache(the_model)
end
def after_destroy(the_model)
expire_cache(the_model)
end
def expire_cache(the_model)
expire_action :controller => '/the_model', :action => 'show'
end
そして得ています:
ActionController::RoutingError (No route matches {:controller=>"/the_model", :action=>"show"}):
私が推測している問題は、スイーパーが after_save と呼ばれているためです。新しいレコードでは、更新または削除時にのみスイープするように具体的に言ったにもかかわらず、破棄するものは何もありません。
(例として、モデルの名前を明らかに「The Model」に変更しました)