Answer the question
In order to leave comments, you need to log in
Rails - where does the extra information come from in the index view?
Hello. Getting to know Rails through Hasbrains screencasts. There was a problem, when rendering the index view, extra information about the products is displayed:
<h1>Items</h1>
<% if @items.empty? %>
<b>Айтемы отсутствуют</b>
<% else %>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Price</th>
<th>Price</th>
</tr>
<%= @items.each do |i| %>
<tr>
<td><%= i.id %></td>
<td><%= link_to i.name, item_path(i) %></td>
<td><%= i.price %>руб.</td>
<td><%= link_to 'Удалить', i, method: :delete, data: { confirm: 'Точно удалить?' } %></td>
</tr>
<% end %>
</table>
<% end %>
def index
@items = Item.all
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question