简体   繁体   English

开发模式下的Rails 3.1资产问题

[英]Rails 3.1 Assets Problem in Dev mode

I am developing a rails 3.1 application. 我正在开发Rails 3.1应用程序。

I put 7 images in app/assets/images//. 我在app / assets / images //中放入了7张图片。

A page is supposed to show the 7 images. 一个页面应该显示7张图像。 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. 有时不显示#1、2、3图像,而有时不显示#6,7图像。

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 山姆

This can sometimes happen if Sprockets' local cache gets corrupted or saves a blank image. 如果Sprockets的本地缓存损坏或保存空白图像,则有时会发生这种情况。 Try deleting the tmp/cache/assets folder and restarting your app. 尝试删除tmp / cache / assets文件夹,然后重新启动应用程序。 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. 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. 某些设置组合会导致图像发生奇怪的事情。

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. 找到了一些建议改用thin的帖子,从而解决了该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM