mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
add validation to variant unit_value
This commit is contained in:
@@ -59,6 +59,8 @@ module Spree
|
||||
%w(weight volume).include?(variant.product.andand.variant_unit)
|
||||
}
|
||||
|
||||
validates :unit_value, numericality: { greater_than: 0 }
|
||||
|
||||
validates :unit_description, presence: true, if: ->(variant) {
|
||||
variant.product.andand.variant_unit.present? && variant.unit_value.nil?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user