Sha256: 7a4f9ecd4ca7fb68d1e005cbc95251ce38250befe9d32d8e4eee8da0211f633b
Contents?: true
Size: 513 Bytes
Versions: 7
Compression:
Stored size: 513 Bytes
Contents
class FutureDateValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if value.present? begin if date = value.to_date if date <= Date.today record.errors[:embargo_release_date] << "Must be a future date" end else record.errors[:embargo_release_date] << "Invalid Date Format" end rescue NoMethodError record.errors[:embargo_release_date] << "Invalid Date Format" end end end end
Version data entries
7 entries across 7 versions & 1 rubygems