Sha256: 769dc6afe4726a1386ee8127e8cbdcecdf6351aa8ff0ad882ad744c7a8bd58d0
Contents?: true
Size: 693 Bytes
Versions: 12
Compression:
Stored size: 693 Bytes
Contents
# encoding: utf-8 module SexyValidations module Validators class Date def self.validate(record, attribute, value, options) return unless value if value.is_a?(::Date) || value.is_a?(::Time) if options.is_a?(Hash) min = options[:within].min if value < min record.errors.add(attribute, "zu früh (frühestens #{min})") end max = options[:within].max if value > max record.errors.add(attribute, "zu spät (spätestens #{max})") end end else record.errors.add(attribute, "ungültig") end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems