Class: Druid::Having::HavingsValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Druid::Having::HavingsValidator
- Defined in:
- lib/druid/having.rb
Constant Summary collapse
- TYPES =
%w(and or)
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/druid/having.rb', line 10 def validate_each(record, attribute, value) if TYPES.include?(record.queryType) value.each(&:valid?) # trigger validation value.each do |avalue| avalue.errors..each do |k, v| record.errors.add(attribute, { k => v }) end end else record.errors.add(attribute, "is not supported by type=#{record.queryType}") if value end end |