When I write this code to show image filename for the alt
:
<img class="card-img-top" alt="<%= store.main_image.filename %>" draggable="false" src="<%= my_store_url(store) %>" />
by using :
store.main_image.filename
for alt
, it doesn't show the actual filename, but numbers like this 1000043.jpg
in production environment.
But when I use it in development environment, it does show the actual filename.
Development:
Production:
<img class="card-img-top" alt="<%= store.main_image.blob.filename.to_s %>" draggable="false" src="<%= my_store_url(store) %>" />
store.main_image.blob.filename.to_s ensures you get the actual filename stored in Active Storage.