Sha256: 5d1b0dc7f2bf48198ec7584d065ebfcf7188ba84911ffeb1d6db2c42f53e8daf

Contents?: true

Size: 285 Bytes

Versions: 3

Compression:

Stored size: 285 Bytes

Contents

module Validations
  class Length
    def self.validate(model, field_name, args)
      errors = {}
      value = model.send(field_name)
      if !value || value.size < args
        errors[field_name] = ["must be at least #{args} chars"]
      end

      return errors
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
volt-0.7.4 lib/volt/models/validations/length.rb
volt-0.7.3 lib/volt/models/validations/length.rb
volt-0.7.2 lib/volt/models/validations/length.rb