Sha256: f46261998fddc3f1be63c1dc14e87ccfd8b34043ff6fe19420383ffd42c3a42d
Contents?: true
Size: 434 Bytes
Versions: 12
Compression:
Stored size: 434 Bytes
Contents
module Mongomatic module Validatable class ValidatesInclusionOf < ValidationBase required_option :within def valid?(instance) value = instance.send(attribute) return true if allow_nil && value.nil? return true if allow_blank && value.blank? within.include?(value) end def message(instance) super || "is not in the list" end end end end
Version data entries
12 entries across 12 versions & 1 rubygems