Class: Druid::Aggregation::FieldnamesValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Druid::Aggregation::FieldnamesValidator
- Defined in:
- lib/druid/aggregation.rb
Constant Summary collapse
- TYPES =
%w(javascript cardinality)
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/druid/aggregation.rb', line 27 def validate_each(record, attribute, value) if TYPES.include?(record.type) record.errors.add(attribute, 'must be a list of field names') if !value.is_a?(Array) || value.blank? else record.errors.add(attribute, "is not supported by type=#{record.type}") if value end end |