Quantcast
Channel: Pragmatic Forums | Posts by osagie uwaifo
Viewing all articles
Browse latest Browse all 8

8.3 Iteration C2: A Smarter Cart posted by osagie uwaifo @ Tue, 20 May 2008 18:25:15 +0000

$
0
0

It is still creating product object. And actually seems right to me. when the add product method is called, we are passing in a product object. The we add the product object to the @items array.

current_item = @items.find {|item| item.product == product}

From the line above we do try to call a method item.product that really does not exist. This seems right.

I think there should be a better way of writing this method. Please let me know what you think. Thanks for your time.


Viewing all articles
Browse latest Browse all 8

Trending Articles