Sha256: 5ebb779e4743c2dca611014bd439b306fc005a0342fdc4b1f786db67f61dc3a8

Contents?: true

Size: 254 Bytes

Versions: 2

Compression:

Stored size: 254 Bytes

Contents

class FutureValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, _value)
    if record[attribute] < Time.now
      record.errors.add(attribute, :invalid, message: (options[:message] || "must be in the future."))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tang-0.2.2 app/validators/future_validator.rb
tang-0.2.1 app/validators/future_validator.rb