Sha256: 6f25f1cb1ffeb4629336da2a918206ce5638ba31ea9233189df00ff6dc15982a
Contents?: true
Size: 542 Bytes
Versions: 66
Compression:
Stored size: 542 Bytes
Contents
module Hydra 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[attribute] << "Must be a future date" end else record.errors[attribute] << "Invalid Date Format" end rescue ArgumentError, NoMethodError record.errors[attribute] << "Invalid Date Format" end end end end end
Version data entries
66 entries across 66 versions & 1 rubygems