Sam Kong
Sam Kong

Reputation: 5840

Rails 3.1 Assets Problem in Dev mode

I am developing a rails 3.1 application.

I put 7 images in app/assets/images//.

A page is supposed to show the 7 images. But my browser doesn't display all the images. Some images are not displayed randomly. Sometimes #1, 2, 3 images are not displayed and other times #6,7 images are not displayed.

If I type the image address in the address field, the image displays well.

This only happened in dev mode. Production mode displays them well.

Has anybody experienced the same thing?

Thanks.

Sam

Upvotes: 1

Views: 530

Answers (2)

Richard Hulse
Richard Hulse

Reputation: 10493

This can sometimes happen if Sprockets' local cache gets corrupted or saves a blank image. Try deleting the tmp/cache/assets folder and restarting your app. Do a forced refresh on the browser to to ensure all images are refetched.

The cache-buster query string is not used in 3.1. This has been replaced with a fingerprinting system (see the asset pipeline guide for more).

If this is an upgraded app, check the settings in your environment files (from the guide) to make sure all the options are set correctly for each mode. Some combinations of setting can cause weird stuff to happen with images.

Upvotes: 5

Pierre
Pierre

Reputation: 8348

What webserver are you using?

I've encountered the same when using passenger. Found some posts advising to switch to thin, which solved the issue.

Upvotes: 1

Related Questions