Sha256: be8327f591491fb064ee34545fb35b567e995000285a7d26842eb82752917335
Contents?: true
Size: 404 Bytes
Versions: 12
Compression:
Stored size: 404 Bytes
Contents
module Validatable class ValidatesAcceptanceOf < ValidationBase #:nodoc: def valid?(instance) value = instance.send(self.attribute) return true if allow_nil && value.nil? return true if allow_blank && (!value or (value.respond_to?(:empty?) and value.empty?)) %w(1 true t).include?(value) end def message(instance) super || "must be accepted" end end end
Version data entries
12 entries across 12 versions & 1 rubygems