如何更改 Rack::Offline 的默认行为
我正在尝试将我的页面缓存在视图文件夹中。我从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
提前致谢。
I am trying to cache my pages in the views folder. I got this from the rack::Offline page but I can't figure out where I am suppsoe to add the code.
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
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它位于您的routes.rb 文件中。此答案中提供了一些很好的信息。
It goes in your routes.rb file. Some good information in this answer.