I deployed my app to production and noticed that images are not served from image_tag, but are served if I use asset_path. I have my images under app/assets/images. On production I precompile them so they are in public/assets and have names such as 'image_name-fk3r23039423-0e9232.png'.
When I look at html code generated I see that my image_tag's src is
/images/logo
while asset_path generates this:
/assets/login-bg1-01eead5b47afcb7e0a951a3668ec3921e8df3f4507f70599f1b84d5efc971855.jpg
So it is correct. So I am interested why I can not serve images using image_tag 'image-name'?
Here is my production.rb
config.serve_static_files = true
config.assets.compile = false
config.assets.digest = true
I resolved this by adding extension to the file. I.e I did this:
<%= image_tag 'logo.png'%> # added .png
I don't know why it didn't worked without extension as in development. So I suppose this logo image is now served from application assets, not from public.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With