Class: Druid::Dimension::ExtractionFnValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/druid/dimension.rb

Constant Summary collapse

TYPES =
%w(extraction)

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/druid/dimension.rb', line 16

def validate_each(record, attribute, value)
  if TYPES.include?(record.type)
    record.errors.add(attribute, 'may not be blank') if value.blank?
  else
    record.errors.add(attribute, "is not supported by type=#{record.type}") if value
  end
end