mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-19 21:51:34 -04:00
Only check values.zero? if they are present
This commit is contained in:
1 parent
d07509f9e4
commit
be07b5fd0e
2 files changed
+3
-3
No files matched your search
@@ -48,7 +48,7 @@ class Garden < ActiveRecord::Base
|
||||
after_validation :cleanup_area
|
||||
|
||||
def cleanup_area
|
||||
self.area = nil if area.zero?
|
||||
self.area = nil if area && area.zero?
|
||||
self.area_unit = nil if area.blank?
|
||||
end
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ class Harvest < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def cleanup_quantities
|
||||
self.quantity = nil if quantity.zero?
|
||||
self.quantity = nil if quantity && quantity.zero?
|
||||
self.unit = nil if quantity.blank?
|
||||
self.weight_quantity = nil if weight_quantity.zero?
|
||||
self.weight_quantity = nil if weight_quantity && weight_quantity.zero?
|
||||
self.weight_unit = nil if weight_quantity.blank?
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user