Class: PGTrunk::AllItemsValidValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- PGTrunk::AllItemsValidValidator
- Defined in:
- lib/pg_trunk/core/validators/all_items_valid_validator.rb
Overview
Ensure that all items in the array are valid
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/pg_trunk/core/validators/all_items_valid_validator.rb', line 6 def validate_each(record, attribute, value) Array.wrap(value).each.with_index.map do |item, index| item.errors..each do |name, list| list.each do || record.errors.add :base, "#{attribute}[#{index}]: #{name} #{}" end end end end |