2

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" >
kilombo1
  • 43
  • 6

1 Answers1

6

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.

Simon Perepelitsa
  • 20,350
  • 8
  • 55
  • 74
  • thank you @Semyon Perepelitsa, I modified the LineItem class moving the method's definition above the "private" keyword and it works. thank you. – kilombo1 Jan 18 '12 at 19:39