lib/sequel/plugins/validation_helpers.rb in sequel-4.35.0 vs lib/sequel/plugins/validation_helpers.rb in sequel-4.36.0
- old
+ new
@@ -157,10 +157,10 @@
end
# Check attribute value(s) against a specified value and operation, e.g.
# validates_operator(:>, 3, :value) validates that value > 3.
def validates_operator(operator, rhs, atts, opts=OPTS)
- validatable_attributes_for_type(:operator, atts, opts){|a,v,m| validation_error_message(m, operator, rhs) unless v.send(operator, rhs)}
+ validatable_attributes_for_type(:operator, atts, opts){|a,v,m| validation_error_message(m, operator, rhs) if v.nil? || !v.send(operator, rhs)}
end
# Validates for all of the model columns (or just the given columns)
# that the column value is an instance of the expected class based on
# the column's schema type.