Html 在rails应用程序中不渲染图像
在这里,我将图像添加到rails应用程序的目录中,该目录位于Html 在rails应用程序中不渲染图像,html,ruby-on-rails,Html,Ruby On Rails,在这里,我将图像添加到rails应用程序的目录中,该目录位于 \app\assets\images\products\mobile 目录 我已经在html.erb文件中添加了img src,但是图像没有在浏览器上渲染…如何在浏览器中渲染图像 下面是我如何添加图像的 <div class="panel-body"> <img src="images/products/mobile-1.jpg"> <div class="product-descri
\app\assets\images\products\mobile
目录
我已经在html.erb文件中添加了img src,但是图像没有在浏览器上渲染…如何在浏览器中渲染图像
下面是我如何添加图像的
<div class="panel-body">
<img src="images/products/mobile-1.jpg">
<div class="product-description">
<h3>IPhone 5s</h3>
</div>
</div>
你试过这个吗
<%= image_tag "products/mobile-1.jpg" %>
使用图像_标记,该标记将自动从资源中拾取图像。您的图像应存储在资产/图像/产品/路径中。
比如说
image_tag("products/mobile-1.jpg")
# => <img alt="Icon" src="/assets/images/products/mobile-1.jpg" />
我会用图像标签
<div class="panel-body">
<%= image_tag("images/products/mobile-1.jpg") %>
<div class="product-description">
<h3>IPhone 5s</h3>
</div>
</div>
试试@Pavan,我试过了,但还是没有渲染图像。