Class: Druid::PostAggregation::NameValidator

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

Constant Summary collapse

TYPES =
%w(arithmetic constant javascript)

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



12
13
14
15
16
# File 'lib/druid/post_aggregation.rb', line 12

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