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

Version Path
quby-5.0.0 lib/active_model_modules/array_attribute_valid_validator.rb
quby-4.0.4 lib/active_model_modules/array_attribute_valid_validator.rb
quby-5.0.0.pre4 lib/active_model_modules/array_attribute_valid_validator.rb
quby-5.0.0.pre3 lib/active_model_modules/array_attribute_valid_validator.rb
quby-5.0.0.pre2 lib/active_model_modules/array_attribute_valid_validator.rb
quby-5.0.0.pre1 lib/active_model_modules/array_attribute_valid_validator.rb
quby-4.0.3 lib/active_model_modules/array_attribute_valid_validator.rb
quby-4.0.2 lib/active_model_modules/array_attribute_valid_validator.rb
quby-4.0.1 lib/active_model_modules/array_attribute_valid_validator.rb
quby-4.0.0 lib/active_model_modules/array_attribute_valid_validator.rb
quby-3.2.2 lib/active_model_modules/array_attribute_valid_validator.rb
quby-3.2.1 lib/active_model_modules/array_attribute_valid_validator.rb
quby-3.2.0 lib/active_model_modules/array_attribute_valid_validator.rb
quby-3.2.0.pre.pre1 lib/active_model_modules/array_attribute_valid_validator.rb