Sha256: 1987d234d140f4828273df148934f715872f8f42f9512fdc8d1ec11e6da645eb
Contents?: true
Size: 445 Bytes
Versions: 34
Compression:
Stored size: 445 Bytes
Contents
class Quby::ArrayAttributeValidValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) value&.each&.with_index do |element, index| if !element.respond_to?(:valid?) record.errors.add(attribute, "element ##{index} does not respond_to valid?") elsif !element.valid? record.errors.add(attribute, "element ##{index} #{element.errors.full_messages.join(', ')}") end end end end
Version data entries
34 entries across 34 versions & 1 rubygems