DEV: add cache breaker for development

Previously iOS could cache scripts (wrongly)
which made debugging very hard
This commit is contained in:
Sam 2018-05-07 11:25:05 +10:00
parent 9c6cf9eb14
commit aa6b779147
1 changed files with 7 additions and 0 deletions

View File

@ -75,6 +75,13 @@ module ApplicationHelper
path.gsub!("#{GlobalSetting.cdn_url}/assets/", "#{GlobalSetting.cdn_url}/brotli_asset/")
end
if Rails.env == "development"
if !path.include?("?")
# cache breaker for mobile iOS
path = path + "?#{Time.now.to_f}"
end
end
"<link rel='preload' href='#{path}' as='script'/>
<script src='#{path}'></script>".html_safe
end