i am getting an error message that has me stumped. i cleared my cart, i cleared my cookies (which destroyed my original post and forced me to relogin here - ugggh!), i verified the code three times and it matches the book.

i'm at a loss.

here goes:

error message:
Code:
undefined method `total_price' for #<Cart:0xb7898594>
...
NoMethodError in Store#add_to_cart
...
12:     <td class="total-cell" ><%= number_to_currency(@cart.total_price) %></td>
the problem i'm having is that def total_price is in cart.rb.

cart.rb
Code:
class Cart

  attr_reader :items

  def initialize
    @items = []
  end

  def add_product(product)
    current_item = @items.find {|item| item.product == product}
    if current_item
      current_item.increment_quantity
    else
      @items << CartItem.new(product)
    end
  end

  def total_price
    @items.sum { |item| item.price }
  end

end
add_to_cart.rhtml
Code:
<div class="cart-title" >Your Cart</div>
<table>
  <% for cart_item in @cart.items %>
    <tr>
      <td><%= cart_item.quantity %>&times;</td>
      <td><%= h(cart_item.title) %></td>
      <td class="item-price" ><%= number_to_currency(cart_item.price) %></td>
    </tr>
  <% end %>
  <tr class="total-line" >
    <td colspan="2" >Total</td>
    <td class="total-cell" ><%= number_to_currency(@cart.total_price) %></td>
  </tr>
</table>
<%= button_to "Empty cart" , :action => :empty_cart %>
the offending code is
Code:
@cart.total_price
if i remove it, the script runs, but, obviously, the total price doesn't display.

if it helps the debug process, i'm using the price_in_cents plugin.

i'm stumped - can anyone point me in the right direction?

as always, tia...