1

I have just added a new loading wheel to my site in assets/images/loading.gif. The gif does work in development, but in production, the browser renders a broken image icon, with no errors. The server is showing the file as 0 bytes, but when I locate the file in the terminal, I can see that it is 3.2k. Other images from assets/images do work. After searching, I tried several things including precompile and changing lines in my config, but as yet, none have worked. Could it be a permissions or a caching issue?

Solved:

The issue was a referencing issue. I was initially referencing the gif in straight html, like so...

<img src="assets/loading.gif" id="loading-indicator" style="display:none" />

but when I used image_tag and changed the file path, it now works.

<%= image_tag("loading.gif", :id => "loading-indicator", :style => "display:none") %>

Not sure why it worked on my local initially.

1
  • how are you referencing the image in code? Mar 28, 2012 at 14:33

1 Answer 1

0

This same issue happened to me after I upgraded to Cedar on Heroku, so I'm guessing you're using Heroku to host your Rails 3.1 app on Cedar.

If so try this in your config/environments/production.rb file comment out the following line:

config/environments/production.rb
===================================
...
config.action_dispatch.x_sendfile_header = "X-Sendfile"
...

And replace it with this new line:

config/environments/production.rb
===================================
...
config.action_dispatch.x_sendfile_header = nil # For Heroku
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.