Sha256: 09c9e2b192d949a13f1fcec542b9412d20decbecc482bb8eb348ac04b15c0192
Contents?: true
Size: 337 Bytes
Versions: 107
Compression:
Stored size: 337 Bytes
Contents
class BirthdayValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return if options[:allow_nil] && value.presence.nil? record.errors.add(attribute, :in_past) if !value || value >= Time.now.to_date record.errors.add(attribute, :after_1920) if !value || value <= Date.new(1920, 1, 1) end end
Version data entries
107 entries across 107 versions & 1 rubygems