I have a cron job which generates a block of static HTML code (saved as an erb template) every 60 minutes, this block shows the most recent 20 products which have been added to a clients product catalogue.
My code renders this block as a partial:
<%= render :partial => "/products/partials/most_recent_products" %>
The problem is however that this partial is getting cached by users browsers who come & browse the site.
Does anyone know how to add some sort of cache-buster here to force the partial code to be reloaded upon each visit by users?
I’ve read lots of instructions for doing this on an individual page or sitewide basis but am having problems figuring out how this can be done just for a partial.
That’s not a browser cache, but Rails. When it runs in production environment – it caches all ERB files, so the simpliest thing is to restart your Rails application. But I think you can make your task without changing ERB template file. Can you provide more info about your needs?