nil can't be coerced into BigDecimal Options

hi guys im playing with RoR with the environment of rails 3 ruby 1.9 i
got stuck in
nil can't be coerced into BigDecimal
i need to get the total cost of the products inside the cart i know
where the problem is(i think) but i almost did every thing
<div class="cart_title" >Your Cart</div>
        <% for item in @cart.line_items %>
        <td><%= item.quantity %>&times;</td>
        <td><%= item.product.title %></td>
    <td class="item_price" ><%= number_to_currency(item.total_price)
    <% end %>
        <tr class="total_line" >
        <td colspan="2" >Total</td>
        <td class="total_cell" ><%=
number_to_currency(@cart.total_price) %></td>
        <%= button_to 'Empty cart', @cart, :method => :delete,
        :confirm => 'Are you sure?' %>
  def total_price
    line_items.to_a.sum { |item| item.total_price }
def total_price
    product.price * quantity
my second option is
def total_price
     if product.price
       product.price * quantity
       product.price = "0.0".to_d
but still this wont work
thanks more power to us!