Rails 4和Leaflet:找不到资产/图像? [英] Rails 4 and Leaflet: assets/images not found?

查看:107
本文介绍了Rails 4和Leaflet:找不到资产/图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的问题确实不应该成为问题.由于某些原因,我无法访问应用程序/资产/图像中的图像.当我请求他们时,我只会得到404.

I am having a problem that really should not be a problem. For some reason the images I have in app/assets/images are not accessable. When I request them I just get a 404.

./log/development.log:Started GET "/assets/images/marker-shadow.png" for 127.0.0.1 at 2013-07-20 22:02:38 -0400
./log/development.log:ActionController::RoutingError (No route matches [GET] "/assets/images/marker-shadow.png"):

mike@sleepycat:~/projects/myapp$ ls app/assets/images/
marker-icon-2x.png  marker-icon.png  marker-shadow.png

这确实应该是一个容易解决的难题……最多重启服务器. 我已经重新启动服务器,检查了文件权限以确保文件具有健全的权限...并且在加载页面时仍会得到404.

This really should be a braindead easy fix... restarting the server at most. I have restarted the server, I have checked the file permissions to make sure the files have sane permissions on them... and I still get 404's when I load my page.

我在这里想念什么?

使用Rails 4.

推荐答案

只需使用此帮助程序即可获取图像:

Just get your image with this helper :

image_path('marker-shadow.png')

rails生成的路径是"/assets/marker-shadow.png",没有"images"文件夹.

The path generated by rails is "/assets/marker-shadow.png" without the 'images' folder.

这篇关于Rails 4和Leaflet:找不到资产/图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆