2

我正在尝试将我的页面缓存在视图文件夹中。我从 rack::Offline 页面得到了这个,但我不知道我应该在哪里添加代码。

offline = Rack::Offline.configure do
  cache "contacts/list." # contacts is the folder in views folder where my list.html.erb file is located
  public_path = Rails.public_path
  Dir[public_path.join("javascripts/*.js")].each do |file|
    cache file.relative_path_from(public_path)
  end
end

提前致谢。

4

1 回答 1

2

它位于您的 routes.rb 文件中。这个答案中有一些很好的信息。

于 2011-03-03T16:16:25.107 回答