开发者

How to change default behavior of Rack::Offline

开发者 https://www.devze.com 2023-02-09 03:36 出处:网络
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.

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
开发者_StackOverflow

Thanks in advance.


It goes in your routes.rb file. Some good information in this answer.

0

精彩评论

暂无评论...
验证码 换一张
取 消