RoR Hell. Agile Web Development book example problems

It seems that @cart.items is returning floats, not items. Maybe check
out your cart model.

Line 9 of line_item.rb

In Ruby, a function returns the value of the last line. The for_product
function is returning the product.price, instead of the item.

You want to add a line to return the item itself:

def self.for_product(product)
    item =
    item.quantity = 1
    item.product = product
    item.unit_price = product.price