When i deploy a rails application in production mode, it appends a date-time string as a query param to the end of all the static asset urls. This is to prevent browsers using old-out of date cahed copies of the assets after I redeploy the application.
Is there a way to make rails use the old time stamps for the assets that have not changed (and only the ones that have not changed) since the last deployment. I want to do this to prevent users having to redownload those assets that have not changed.
I think you can use ENV[‘RAILS_ASSET_ID’] to alter the cache-busting asset ID. Unfortunately, this is for all assets.
But if it’s not set, it uses the asset’s source modification time. If that file hasn’t been modified since the last time you used it, it shouldn’t be a problem.
If the asset ID is changing when they haven’t been changed, it might be because of your deployment process altering the modification time and maybe you could look at tweaking that.
Lastly, you can always override rails_asset_id with your own custom method.
Hope this helps.