app/views/produtos/index.html.erb
<% # encoding: utf-8 %>
<meta charset="UTF-8">
<%= content_for :nav do%>
<%= render "layouts/navbar" %>
<% end %>
<%= render "shared/notice" %>
<h1>Produtos</h1>
<table class = "table table-striped">
<thead>
<tr>
<th>ID</th>
<th>Cod barras</th>
<th>Nome</th>
<th>Marca</th>
<th>Descrição</th>
<th>É vegano?</th>
<th>Justificativa</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @produtos.each do |produto| %>
<tr>
<td><%= produto.id %></td>
<td><%= produto.cod_barras %></td>
<td><%= produto.nome %></td>
<td><%= produto.marca.nome %></td>
<td><%= produto.descricao %></td>
<td><%= produto.class_vegan %></td>
<td><%= produto.justificativa %></td>
<td><%= link_to 'Mostrar', produto %></td>
<td><%= link_to 'Editar', edit_produto_path(produto) %></td>
<td><%= link_to 'Deletar', produto, method: :delete, data: { confirm: 'Tem certeza?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'Novo Produto', new_produto_path %>