Sha256: 0399c87737b5dd0a7bc6ad7267ec105b077c16a1c07d7bae28ed269395082b78

Contents?: true

Size: 233 Bytes

Versions: 1

Compression:

Stored size: 233 Bytes

Contents

class DateFormatValidator < ActiveModel::EachValidator # :nodoc:
  def validate_each(record, attribute, value)
    Date.parse(value)
  rescue ArgumentError, TypeError
    record.errors.add(attribute, 'is not a Date format')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csv_row_model-1.0.0.beta2 lib/csv_row_model/validators/date_format_validator.rb