Happy Nose
Happy Nose

Reputation: 35

Image not showing in production

I have the following code in my view:

<p>
<%= image_tag( "folder/"+"image_name.jpeg" ) %>
</p>

In development mode when I visit the server the image shows and its path is:

http://localhost:3000/assets/folder/image_name-f562b410b0627f8099a44de48f5ee8fff6b1babf98dacfcf307a39a8b7fefbca.jpg

In production mode when I visit the page the image does not shows and its path is:

domain/images/folder/image_name.jpeg

the image in the production site is in the following path:

domain/assets/folder/image_name-f562b410b0627f8099a44de48f5ee8fff6b1babf98dacfcf307a39a8b7fefbca.jpg

Why does the link does not update automatically in the production mode like is updated in the development mode.

I already tried:

rake assets:precompile RAILS_ENV=production

Upvotes: 3

Views: 2992

Answers (2)

Jigar Bhatt
Jigar Bhatt

Reputation: 4680

I was able to solve this problem by changing:

config.assets.compile = false to

config.assets.compile = true

in /config/environments/production.rb

Upvotes: 1

ihtishaam ahmed
ihtishaam ahmed

Reputation: 409

(Not Working) Try in following order:

rails assets:clobber
rails assets:precompile

Try:

check whether config.assets.compile is set to true in config/environments/production.rb

Upvotes: 5

Related Questions