Sha256: 476cefec70bac8e4e469e15cae804d523c88ad54536978f8d209a5a4bc455ddd

Contents?: true

Size: 233 Bytes

Versions: 4

Compression:

Stored size: 233 Bytes

Contents

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tang-0.2.0 app/validators/future_validator.rb
tang-0.1.0 app/validators/future_validator.rb
tang-0.0.9 app/validators/future_validator.rb
tang-0.0.8 app/validators/future_validator.rb