rails 4 page index cache创建index.html而不是model.html

时间:2014-10-23 07:20:59

标签: ruby-on-rails caching ruby-on-rails-4

我有一个名为product的模型,我打算在索引操作上实现页面缓存。

在我的Gemfile中,我已经包含了

gem 'actionpack-page_caching'
gem 'actionpack-action_caching'

在我的控制器中我有

caches_page :index

在我的routes.rb中我有

resources :products, :path => "toys"

问题: 在我的public目录中,与预期的&products; products.html'相比,正在创建的html文件名为index.html。或者' toys.html'

当我expire_page products_path成功创建/更新产品时,此问题会让我感到不适,该应用会查找products.html或' toys.html'删除,但无法找到它,并且有效地不刷新缓存。

有谁知道为什么rails 4会命名缓存页面index.html

1 个答案:

答案 0 :(得分:0)

尝试在更新中添加创建操作:

expire_page action: 'index'