Using Rails 4 on Heroku, precompiling assets and adding fingerprints.
I can access the assets from my erb files using:
<%= asset-url("image_name.jpg") %>
However, I'm making an ajax call to a controller to get a list of objects and I build an image name from each object, e.g. image-1.jpg, image-2.jpg, where the number here is from the javascript variable. These images are in the assets/images directory.
How can I link to them using the javascript variable, like this:
<%= asset-url("image-javascriptVariable.jpg") %>
This obviously doesn't work because it's rendered on the server well before the client renders the javascript variable.
Note: I know I could simply not preprocess/fingerprint these images and put them in public/assets and serve them static. However, I'd like to use the fingerprinting to break cache on updates.