Images not filed during production through image_tag in Rails 4

I deployed my production application and noticed that the images are not served from image_tag, but are served if I use path_path. I have my images under app / assets / images. At the factory, I precompile them so that they are in the public / assets and have names such as "image_name-fk3r23039423-0e9232.png".

When I look at the generated HTML, I see that my image_tag src

/images/logo 

while resource_path generates this:

 /assets/login-bg1-01eead5b47afcb7e0a951a3668ec3921e8df3f4507f70599f1b84d5efc971855.jpg 

So this is correct. So I wonder why I can not display images using image_tag 'image-name'?

Here is my production.rb

 config.serve_static_files = true config.assets.compile = false config.assets.digest = true 
+6
source share
1 answer

I solved this by adding the extension to the file. I have done this:

 <%= image_tag 'logo.png'%> # added .png 

I do not know why it did not work without extension, as in development. Therefore, I assume that this image of the logo is now coming from the assets of the application, and not from the public.

+7
source

All Articles