我正在尝试将我的页面缓存在视图文件夹中。我从 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
提前致谢。