Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images not served in production via image_tag in Rails 4

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
like image 754
yerassyl Avatar asked Apr 25 '16 06:04

yerassyl


1 Answers

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.

like image 105
yerassyl Avatar answered Oct 27 '22 00:10

yerassyl