【发布时间】:2020-06-30 23:51:08
【问题描述】:
我在 Heroku 上托管了一个 Rails 应用程序,我正在尝试为其更新 robots.txt 文件。
早些时候,在我的production.rb 中,我有:
config.static_cache_control = "public, max-age=2592000"
但是,我把它改成了:
config.static_cache_control = "public, max-age=0"
并将代码再次推送到生产环境。
我也尝试过运行:
Rails.cache.clear 在 heroku rails console 中,但 /robots.txt 仍在显示旧文件。
编辑:
我已从 public 文件夹中删除了“robots.txt”文件。
再次清理和预编译资产,也没有用。
我仍然可以在生产环境中访问它。
【问题讨论】:
-
如何在应用程序中进行缓存?您是否在
production.rb中设置了config.cache_store?
标签: ruby-on-rails heroku caching