После создания миграции и добавления в шаблон index строчки с рейтингом, лезет такая ошибка при обновлении адреса ...*/items
задал drak0n 4 месяца назад
к скринкасту Другие экшены в RESTful контроллере.
NoMethodError in Items#index
Showing /home/drakon/my_store/app/views/items/index.html.erb where line #22 raised:
undefined method `votes_count' for #
Extracted source (around line #22):
19: <td><%= link_to i.name, item_path(i) %></td>
20: <td><%= i.price %> руб.</td>
21: <td><%= link_to "Удалить", i, method: :delete, data: { confirm: "Точно удалить?" } %></td>
22: <td>Рейтинг: <%= i.votes_count %>, <%= link_to "+", upvote_item_path(i) %></td>
23: </tr>
24:
25: <% end %>
Rails.root: /home/drakon/my_store
Application Trace | Framework Trace | Full Trace
app/views/items/index.html.erb:22:in `block in _app_views_items_index_html_erb___4102266503868764696_70216139854280'
app/views/items/index.html.erb:15:in `each'
app/views/items/index.html.erb:15:in `_app_views_items_index_html_erb___4102266503868764696_70216139854280'
Request
Parameters:
None
Show session dump
Show env dump
Response
Headers:
None
Showing /home/drakon/my_store/app/views/items/index.html.erb where line #22 raised:
undefined method `votes_count' for #
Extracted source (around line #22):
19: <td><%= link_to i.name, item_path(i) %></td>
20: <td><%= i.price %> руб.</td>
21: <td><%= link_to "Удалить", i, method: :delete, data: { confirm: "Точно удалить?" } %></td>
22: <td>Рейтинг: <%= i.votes_count %>, <%= link_to "+", upvote_item_path(i) %></td>
23: </tr>
24:
25: <% end %>
Rails.root: /home/drakon/my_store
Application Trace | Framework Trace | Full Trace
app/views/items/index.html.erb:22:in `block in _app_views_items_index_html_erb___4102266503868764696_70216139854280'
app/views/items/index.html.erb:15:in `each'
app/views/items/index.html.erb:15:in `_app_views_items_index_html_erb___4102266503868764696_70216139854280'
Request
Parameters:
None
Show session dump
Show env dump
Response
Headers:
None