我在 Rails 3.2 上,我的图像im.png
位于app/assets/images
. 如何在我的网站上访问它?我试过app/assets/images/im.png
and im.png
,但都不管用。
问问题
271 次
2 回答
1
Use the image_tag
helper:
<%= image_tag('im.png') %>
Which will generate a URL like:
/assets/im.png
Which is a "virtual" URL and doesn't exist on disk - but the asset pipeline will serve it from app/assets/images/im.png
where it does in fact reside on disk.
于 2013-06-15T01:57:26.330 回答
0
<%= image_tag("im.png") %>
返回图像的 HTML 标记:
<img src="/assets/im.png" />
你可以使用任何一个,你会得到相同的结果。
于 2013-06-15T02:30:17.167 回答