49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/druid/query.rb', line 49
def validate_each(record, attribute, value)
if TYPES.include?(record.queryType)
if value.is_a?(String)
record.errors.add(attribute, "must be one of #{SIMPLE.inspect}") unless SIMPLE.include?(value)
elsif value.is_a?(Granularity)
value.valid?
value.errors.messages.each do |k, v|
record.errors.add(attribute, { k => v })
end
else
record.errors.add(attribute, "invalid type or class: #{value.inspect}")
end
else
record.errors.add(attribute, "is not supported by type=#{record.queryType}") if value
end
end
|