class AmericanDateParsing::AmericanDateValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/american_date_parsing.rb, line 56
def validate_each(record, attribute, value)
  Validation.new({
    value:   record.read_attribute(attribute),
    raw:     record.send(:"_raw_#{attribute}"),
    options: options
  }).errors.each do |error, opts|
    opts = opts.respond_to?(:keys) ? opts : {}
    record.errors.add(attribute, error, opts)
  end
end