Rails assets images in production
I found some strange behavior of assets images
If I run unicorn in production mode at hosting - /assets/image.png - server give me blank image ie file exist, but size=0 . In same time at localhost I run in unicorn development mode - and all works fine, Then I run webrick at hosting - images are display fine. After that I run unicorn开发者_JS百科 in production mode at localhost and images stops display, then I run unicorn in development images already doesn't work.
Rails 3.1.0.rc6, after that I update to rc8 at hosting but nothing happened
Maybe production mode build some cache, which remains forever?
There are different things that may go wrong, so here the ideas you have to check:
- There is a known error in Rails 3.1, that the precompilation of assets does not work properly. See Upgrade to Rails 3.1.0 from rc6, asset precompile fails for a question with a solution.
- I had problems with creating precompiled assets for production. The following worked for me (after fixing the error above):
- Ensure that your application is not running in production mode.
- Call
bundle exec rake assets:clean
. This will clean all resources hanging around. - Call
bundle exec rake assets:precompile
afterwards. As a result, the directory/public/assets
should be filled with assets with the hash appended (e.g.icon_add-96985e087048a8c2e09405494509750d.gif
instead oficon-add.gif
). - Start your server in production mode.
- Depending on the browser I used, I had to refresh or even clear all caches. Especially Chrome was very nasty in caching resources that he should not cache.
I hope some of the ideas will help you find the source of your problem.
精彩评论