Show us the code of LineItem class.
This method raises the error on a new instance. To avoid it, it must return BigDec anytime. In your case product.price is nil or quantity is nil.. def total_price product.price * quantity end On 21.02.2012, at 13:55, ruby LED wrote: > Colin Law wrote in post #1047978: >> On 21 February 2012 09:39, ruby LED <[email protected]> wrote: >>> >>> it feels like im adding a nil value at my first attemp of adding a >>> product into my cart? >> >> It is not the item that is nil but total_price. If it were the item >> that were nil then you would get an error saying that nil did not have >> a method total_price. Where are you setting total_price when you do >> LineItem.new. >> > i belive im setting it in the current_item it self > current_item = LineItem.new(:product_id=>product_id) >> Colin > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

