ruby - Why images are not showing in my rails basic app -
my index.html.erb
code -
<h1>listing products</h1> <table border="1"> <% @products.each |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 sure?' } %></td> </tr> <% end %> </table> <br /> <%= link_to 'new product', new_product_path %>
and images under app\assets\images
..but still images not appearing on front end.
when firebug
it, believe image tag correctly forming...let me know missing in part.
<img src="/images/product1.jpg" class="list_image" alt="product1">
screenshot -
images in place -
let me know doing wrong , how fix it.
edit
let me know why not working in case.
although changing /images/product1.jpg
to /assets/product1.jpg
makes working.
if using asset pipeline http://guides.rubyonrails.org/asset_pipeline.html,
the image path should /assets/product1.jpg
instead of /images/product1.jpg
if not using asset pipeline, move images folder public/images
Comments
Post a Comment