Вопрос

I'm working with Depot tutorial, I'm having an issue when defining total price: this is the error I'm getting: does anyone knows what is wrong with it? thank you.

NoMethodError in Carts#show

Showing C:/pan/app/views/carts/show.html.erb where line #7 raised:

private method `total_price' called for #<LineItem:0x3ed2640>
Extracted source (around line #7):

4: <tr>
5: <td><%= item.quantity %>&times;</td>
6: <td><%= item.product.brand %></td>
7: <td class="item_price" ><%= number_to_currency(item.total_price) %></td>
8: </tr>
9: <% end %>
10: <tr class="total_line" >
Это было полезно?

Решение

Make sure this method's definition is not under private keyword in the LineItem class, otherwise it is considered private and is not allowed to be called outside the class.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top