| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Potion Store
Revision: 68
Author: andykim78
Date: 14 Feb 2008 18:02:54
Changes:Clean up octal number in quantity field
Files:| ... | ...@@ -253,7 +253,7 @@ | |
| 253 | 253 | item.order |
| 254 | 254 | item.order = self |
| 255 | 255 | item.product_id = product_id |
| 256 | item.quantity = Integer(items[product_id]) | |
| 256 | item.quantity = Integer(items[product_id].sub(/^0+/, '')) # take care of leading zeroes so that the quantity does not get treated as an octal number | |
| 257 | 257 | next if item.quantity == 0 |
| 258 | 258 | if item.quantity < 0 |
| 259 | 259 | return false |
| ... | ...@@ -1,3 +1,6 @@ | |
| 1 | 2008-02-14 Andy Kim <andy@potionfactory.com> | |
| 2 | * Clean octal numbers in quantity field | |
| 3 | ||
| 1 | 4 | 2008-01-16 Andy Kim <andy@potionfactory.com> |
| 2 | 5 | |
| 3 | 6 | Version 0.4.0 |
| ... | ...@@ -4,7 +4,7 @@ | |
| 4 | 4 | belongs_to :order |
| 5 | 5 | belongs_to :product |
| 6 | 6 | |
| 7 | validates_numericality_of :quantity | |
| 7 | validates_numericality_of :quantity, :only_integer => true | |
| 8 | 8 | validates_numericality_of :unit_price |
| 9 | 9 | |
| 10 | 10 | def quantity=(qty) |