0
생성에 실패 여기서레일 캐시 스위퍼 내가 컨트롤러가
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라고 불려지기 때문에 새로운 기록을 남기면 파괴 할 것이 없을 것입니다. 업데이트 또는 삭제시 p.
이
실제 코드에서 컨트롤러 이름에 /를 사용하고 있습니까? – Novae
예, ActiveAdmin의 문제로 인해이를 사용해야합니다. 그렇지 않으면 "admin/the_model"을 지우려고 시도합니다. http://stackoverflow.com/questions/10465964/sweepers-not-working-unless-manually-invoked- 무슨 일이 벌어지고 있습니까? –
코드는 나 자신을 시험하지 않고 나에게 잘 보입니다. 하지만 after_sdate 대신 after_update를 시도하여 의심스러운 점을 확인하십시오. – Novae