Sha256: be44a1718c4ad57afcd4aa6794d72ef9ff43ca0a1572a51d9b687f4d96657430

Contents?: true

Size: 246 Bytes

Versions: 2

Compression:

Stored size: 246 Bytes

Contents

class LowercaseValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    value = "" if value.nil?
    record.errors.add attribute, (options[:message] || "must be lowercase") unless value == value.downcase
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kaze-0.4.0 stubs/default/app/validators/lowercase_validator.rb
kaze-0.3.0 stubs/default/app/validators/lowercase_validator.rb