Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.1.x - image_tag doesn't use the precompiled file in production mode

In my views I put :

<%= image_tag("coin.png") %>

My original image is put on :

app/assets/images/coin.png

But in production mode the html code generated by image_tag is :

<img alt="Coin" src="/assets/coin.png">

Instead of hitting precompiled assets :

coin-aba0e66819d64251cb3bb4bb29b26eb2.png

(and naturally I cant see the image).

I didn't forgot to precompile my assets.

and my environment/production.rb is :

  config.cache_classes = true                                                                                                                                                                                   
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true                                                                                                                                                               
  config.serve_static_assets = false                                                                                                                                                                                                              
  config.assets.compress = true                                                                                                                                                                                                
  config.assets.js_compressor  = :uglifier
  config.action_dispatch.x_sendfile_header = "X-Accel-Redirect"   

Thanks you a lot

like image 714
Unitech Avatar asked Aug 31 '11 23:08

Unitech


1 Answers

I found it !!!!!!!

Add to your production.rb :

config.assets.digest = true
like image 54
Unitech Avatar answered Nov 15 '22 20:11

Unitech