Sha256: 13b505eb2d24e572d23651e65f6f6a9f54adfcf82e794ecf72189f3bbb5d2225
Contents?: true
Size: 415 Bytes
Versions: 12
Compression:
Stored size: 415 Bytes
Contents
module Mongomatic module Validatable class ValidatesAcceptanceOf < ValidationBase #:nodoc: def valid?(instance) value = instance[self.attribute.to_s] return true if allow_nil && value.nil? return true if allow_blank && value.blank? %w(1 true t).include?(value) end def message(instance) super || "must be accepted" end end end end
Version data entries
12 entries across 12 versions & 1 rubygems