Rails asset pipeline can't find one certain image

强颜欢笑 提交于 2019-12-21 18:31:26

问题


I have a certain image called ui-icons_ffffff_256x240.png. In production it can be found, among other places, in public/assets/images/ui-icons_ffffff_256x240.png.

When I try to view this image in production, I get the following error:

ActionController::RoutingError (No route matches [GET] "/assets/images/ui-icons_ffffff_256x240.png"):

I find this extremely odd since the image most certainly is there:

$ find . -name ui-icons_ffffff_256x240.png
./vendor/assets/stylesheets/jquery-ui/images/ui-icons_ffffff_256x240.png
./public/assets/jquery-ui/images/ui-icons_ffffff_256x240.png
./public/assets/images/ui-icons_ffffff_256x240.png

All the other images in my app work fine and have been forever. I recently upgraded my version of jQuery UI, though, and this one particular image doesn't want to work. (I think it's the only jQuery UI image I'm actually using.)

I'm on Rails 3.2.1. What could be the issue?


回答1:


Your js plugin requests the image with invalid asset url. The asset image can be accessed by

/assets/ui-icons_ffffff_256x240.png

But the requested url is

/assets/images/ui-icons_ffffff_256x240.png

So in your javascript or stylesheet you need to correct asset url manually.



来源:https://stackoverflow.com/questions/11182696/rails-asset-pipeline-cant-find-one-certain-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!