small medium large xlarge

Generic-user-small
26 Sep 2011, 09:58
Daniel Halvorsen (2 posts)

hi, ive got a wierd problem that i think is perhaps a stupid mistake on my part, but i cant figure out what it is.

NoMethodError in Carts#show

Showing /home/hrzn/Documents/Ruby/work/depot/app/views/carts/show.html.erb where line #18 raised:

undefined method `total_price’ for #

Extracted source (around line #18):

15: 16: <tr class="total_line"> 17: <td colspan="2">Total</td> 18: <%= number_to_currency(@cart.total_price) %></td> 19: </tr> 20: 21: </table>

i did look at it self to see if there are anything i forgot, but it looks excactly like the online source code.

please any help woud be much appreciated

if i remove line 18 then everything work again, but it just cant seem to find the definition of the method.

Samr_small_pragsmall
26 Sep 2011, 19:48
Sam Ruby (634 posts)

Unfortunately, it looks like the software used to support this forum has eaten a number of key parts of this post, enough to make it difficult to determine what the problem is. A key piece of information would be knowing what came after the # in the undefined method error message.

In any case, total_price is defined in section E3 (page 136 of the PDF), in app/models/line_item.rb.

Generic-user-small
27 Sep 2011, 07:39
Daniel Halvorsen (2 posts)

i found my problem i accidently read the total_price from a different method, so it was my mistake.

thanks for reply

You must be logged in to comment