Sha256: 713ac0bfe8b92392fb88a0fb6f99a59c86af3d0d6f780e77dc27a0fd85946f3c
Contents?: true
Size: 262 Bytes
Versions: 1
Compression:
Stored size: 262 Bytes
Contents
class YearValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return if value.blank? unless ((min=1700) .. (max=2200)).include? value record.errors.add attribute, :year_invalid, min: min, max: max end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
activemodel-validators-1.0.0 | lib/activemodel-validators/year_validator.rb |