class ActiveModel::Validations::HexColorValidator
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
# File lib/active_validators/active_model/validations/hex_color_validator.rb, line 4 def validate_each(record, attribute, value) unless value =~ /\A(\h{3}){,2}\z/ record.errors.add(attribute) end end