I am working with a Rails 5.2 application
Locally I added a new image to app/assets/images/my-file-name.jpg
and then in my .erb file I reference it using
<%= image_tag "my-file-name.jpg" %>
Then when I deploy to Heroku I run the following steps locally
rake assets:clobber
<!-- this destroys the public/assets
folder as expectedRAILS_ENV=production bundle exec rake assets:precompile
this creates a new public/assets
folder but now each of the files within the assets folder have a hash after their name. So my file my-file-name.jpg
has become my-file-name-{BigLongCacheBustingHashHere}.jpg
<%= image_tag my-file-name.jpg %>
is still producing a static html link WITHOUT the hash. It looks like this <img src="my-file-name.jpg">
when I believe it should be producing a tag that looks like <img src="my-file-name-{BigLongCashBustingHashHere}.jpg"
Why do you think the <%= image_tag %> is not producing production friendly urls? I can see that it is working elsewhere in the app so not sure where I am going wrong.
OMG I lost hours of my life on this. Rails assets does not like .jpeg extensions and will flat out ignore them in production. So I just changed the file name to my-file-name.jpg
and now Rails is happy