pnomolos-cart 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cart/simple.rb +11 -2
- metadata +1 -1
data/lib/cart/simple.rb
CHANGED
@@ -79,7 +79,12 @@ class Cart
|
|
79
79
|
|
80
80
|
def update(product, count = nil)
|
81
81
|
if (item = find(product)) && !count.nil?
|
82
|
-
|
82
|
+
# Make sure we've got Integers. Lots of integers!
|
83
|
+
begin
|
84
|
+
item.count = count.to_i
|
85
|
+
rescue
|
86
|
+
return false
|
87
|
+
end
|
83
88
|
end
|
84
89
|
end
|
85
90
|
|
@@ -93,7 +98,11 @@ class Cart
|
|
93
98
|
|
94
99
|
def quantity(product)
|
95
100
|
if item = find(product)
|
96
|
-
|
101
|
+
# This should always be an Integer
|
102
|
+
begin
|
103
|
+
return item.count.to_i
|
104
|
+
rescue
|
105
|
+
end
|
97
106
|
end
|
98
107
|
return 0
|
99
108
|
end
|