Rails 关于 Rails 片段缓存的问题

loyalpartner · February 25, 2015 · Last by loyalpartner replied at February 26, 2015 · 1562 hits

rails 版本:4.2.0

我想在显示分类列表的时候做一个片段缓存,然后删除一个分类的时候同时删除片段缓存 代码如下 index.html.slim 代码

- cache('hello') do
  = show_categories Category.root_categories

controller 代码

def destroy
  expire_fragment 'hello'
  @category.destroy
  respond_to do |format|
    format.html { redirect_to categories_url, notice: 'Category was successfully destroyed.' }
    format.json { head :no_content }
  end
end

可是在我提交删除请求后,缓存并没有删除

You need to Sign in before reply, if you don't have an account, please Sign up first.