class PGTrunk::AllItemsValidValidator

@private Ensure that all items in the array are valid

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# 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.messages.each do |name, list|
      list.each do |message|
        record.errors.add :base, "#{attribute}[#{index}]: #{name} #{message}"
      end
    end
  end
end