projects
/
depot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Finished chapter 11
[depot.git]
/
app
/
models
/
cart.rb
diff --git
a/app/models/cart.rb
b/app/models/cart.rb
index 88061d380470188dcf6991dcd5e0cdb3f966799d..bd51c383311d6a0a008208a3908955e330be963a 100644
(file)
--- a/
app/models/cart.rb
+++ b/
app/models/cart.rb
@@
-20,4
+20,8
@@
class Cart
@items.sum {|item| item.price}
end
@items.sum {|item| item.price}
end
+ def total_items
+ @items.sum {|item| item.quantity}
+ end
+
end
end