Reputation: 29
I'm using ruby on rails. This should be very simple, but it doesn't work. I put my image to assets/images and named it aa2.png. I used in in the view template and it doesn't work. I can't figure out why... Here's the html code:
<div class="container-fluid">
<div class="row">
<div class="col-md-6"><img src="aa2.png"></div>
<div class="col-md-6">.col-md-6</div>
</div>
</div>
Upvotes: 1
Views: 1021
Reputation: 768
When using img src, we have use absolute path of the image as:
<img src="/assets/aa2.png"/>
Upvotes: 0
Reputation: 3512
Use the Image Tag helper
<div class="container-fluid">
<div class="row">
<div class="col-md-6"><%= image_tag('aa2.png') %></div>
<div class="col-md-6">.col-md-6</div>
</div>
</div>
Upvotes: 4
Reputation: 3699
it must be
<img src="/assets/aa2.png">
but prefer
<%= image_tag("/assets/aa2.png", alt: "logo") %>
use browser console to detect file path issues
Upvotes: 1