lib/sequel/plugins/validation_helpers.rb in sequel-3.20.0 vs lib/sequel/plugins/validation_helpers.rb in sequel-3.21.0
- old
+ new
@@ -70,11 +70,11 @@
validatable_attributes_for_type(:format, atts, opts){|a,v,m| validation_error_message(m, with) unless v.to_s =~ with}
end
# Check attribute value(s) is included in the given set.
def validates_includes(set, atts, opts={})
- validatable_attributes_for_type(:includes, atts, opts){|a,v,m| validation_error_message(m, set) unless set.include?(v)}
+ validatable_attributes_for_type(:includes, atts, opts){|a,v,m| validation_error_message(m, set) unless set.send(set.respond_to?(:cover?) ? :cover? : :include?, v)}
end
# Check attribute value(s) string representation is a valid integer.
def validates_integer(atts, opts={})
validatable_attributes_for_type(:integer, atts, opts) do |a,v,m|
@@ -87,10 +87,10 @@
end
end
# Check that the attribute values length is in the specified range.
def validates_length_range(range, atts, opts={})
- validatable_attributes_for_type(:length_range, atts, opts){|a,v,m| validation_error_message(m, range) unless v && range.include?(v.length)}
+ validatable_attributes_for_type(:length_range, atts, opts){|a,v,m| validation_error_message(m, range) unless v && range.send(range.respond_to?(:cover?) ? :cover? : :include?, v.length)}
end
# Check that the attribute values are not longer than the given max length.
#
# Accepts a :nil_message option that is the error message to use when the