2011-04-13 57 views

回答

1

這是我的解決方案。

控制器

helper_method :custom_cache_path 

before_filter only: [:method] do 
    if params[:reset_cache] 
    expire_fragment(custom_cache_path) 
    end 
end 

def custom_cache_path 
    "#{params[:id].to_i}-#{params[:controller]}-#{params[:action]}" 
end 

休息請求

RestClient.get "http://example.com/controller/method?reset_cache=1"