image_path生成不同的路径

时间:2014-07-01 13:58:32

标签: ruby-on-rails asset-pipeline

我正在使用image_path帮助器来包含apple-touch-icons。图标位于文件夹app_icons中。这是文件夹结构:

enter image description here

现在,生成的网址为images/app_icons/icon@2x.png,我得到no route matches例外。但对于其他文件夹中的所有其他图像,我得到assets/event_logos/xxxx.jpg并且它有效。我已经使用了很长一段时间了,我不知道这里出了什么问题。

这是ERB:

enter image description here

这是HTML输出:

enter image description here

1 个答案:

答案 0 :(得分:0)

如果无法在/images中找到具有指定名称的资产,则Rails将回退到/assets的默认路径,可能假设您要从/public/images呈现图片

检查拼写错误的文件名 - 确保icon@2x.png文件夹中有一个名为/app/assets/images/的文件。

相关问题