Sha256: 8ba49b55661adf6c5d947f65bcb1b36497b36c22643a2b7c0540b266651f98a7
Contents?: true
Size: 337 Bytes
Versions: 1
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(1930, 1, 1) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
egov_utils-0.1.13 | app/validators/birthday_validator.rb |