Sha256: 4f3cf27f10f411929f26e7523b9aaa2e65aacfa76206dd958410294454d7988e

Contents?: true

Size: 195 Bytes

Versions: 3

Compression:

Stored size: 195 Bytes

Contents

require 'active_model'

class RequiredValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    record.errors.add(attribute, 'is required') if value.nil?
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
minarai-0.0.3 lib/validator/required_validator.rb
minarai-0.0.2 lib/validator/required_validator.rb
minarai-0.0.1 lib/validator/required_validator.rb