my index.html.erb
code -
<h1>Listing products</h1>
<table border="1">
<% @products.each do |product| %>
<tr>
<td><%= product.title %></td>
<td><%= product.description %></td>
<td><%= image_tag(product.image_url, :class => 'list_image') %></td>
<td><%= product.price %></td>
<td><%= link_to 'Show', product %></td>
<td><%= link_to 'Edit', edit_product_path(product) %></td>
<td><%= link_to 'Destroy', product, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New Product', new_product_path %>
and images are under app\assets\images
..but still images are not appearing on front end.
When I Firebug
it, i believe image tag is correctly forming...let me know what i am missing in this part.
<img src="/images/product1.jpg" class="list_image" alt="Product1">
Screenshot -
Images are in place as well -
Let me know what I am doing wrong and how do i fix it.
EDIT
Let me know why it is not working in my case.
Although changing /images/product1.jpg
To /assets/product1.jpg
makes it working.
src
attribute:<img src="/images/product1.jpg" class="list_image" alt="Product1">
to<img src="product1.jpg" class="list_image" alt="Product1">
in firebug