Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在heroku上为rails 3.1应用程序启用浏览器端缓存_Ruby On Rails_Ruby On Rails 3_Heroku_Browser Cache_Cache Control - Fatal编程技术网

Ruby on rails 在heroku上为rails 3.1应用程序启用浏览器端缓存

Ruby on rails 在heroku上为rails 3.1应用程序启用浏览器端缓存,ruby-on-rails,ruby-on-rails-3,heroku,browser-cache,cache-control,Ruby On Rails,Ruby On Rails 3,Heroku,Browser Cache,Cache Control,我有一个相当大的jpg图像文件和一些css文件,这些文件不会在每次重新加载时更改,但每次加载完整的imgae而不是在浏览器中缓存时,我都尝试更改config.action\u controller.perform\u caching=true等配置,但似乎没有任何帮助。有什么方法可以做到这一点吗?这在我的制作过程中非常有效。rb: config.serve_static_assets = true config.static_cache_control = "public, max-age=24

我有一个相当大的jpg图像文件和一些css文件,这些文件不会在每次重新加载时更改,但每次加载完整的imgae而不是在浏览器中缓存时,我都尝试更改config.action\u controller.perform\u caching=true等配置,但似乎没有任何帮助。有什么方法可以做到这一点吗?

这在我的制作过程中非常有效。rb:

config.serve_static_assets = true
config.static_cache_control = "public, max-age=2419200"

那是4个星期,我想这已经足够好了

我也想得到一个答案:(我想我已经在我的应用程序上添加了缓存。阅读这些:我不确定它是否是浏览器缓存,但它正在缓存我的静态文件!为了避免需要记住2419200秒的确切时间,可以使用ActiveSupport:
config.static\u cache\u control=“public,max age={1.month.To\I}”