mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-09 03:20:21 +00:00
Transform weight before validation
I guess validates_length_from_database also validates numbers. That's not a bad thing. So now it's being validated, we should validate the transformed value that will be saved to the database.
This commit is contained in:
committed by
Rachel Arnould
parent
9a9be8dacd
commit
117085aeba
@@ -81,8 +81,8 @@ module Spree
|
||||
before_validation :ensure_shipping_category
|
||||
before_validation :ensure_unit_value
|
||||
before_validation :update_weight_from_unit_value, if: ->(v) { v.product.present? }
|
||||
before_validation :convert_variant_weight_to_decimal
|
||||
|
||||
before_save :convert_variant_weight_to_decimal
|
||||
before_save :assign_units, if: ->(variant) {
|
||||
variant.new_record? || variant.changed_attributes.keys.intersection(NAME_FIELDS).any?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user