Sha256: 6314692f172eb93a3e88b8d41d773a2cb15d7b5455ca3227abde4634c367001f

Contents?: true

Size: 501 Bytes

Versions: 9

Compression:

Stored size: 501 Bytes

Contents

module ActiveModel
  module Validations
    # Adds support for validation to read attribute names like foo[0].
    # Mainly used to validate collections.
    module CollectionItemsValidator::ArrayAttributeReader
      def read_attribute_for_validation(attribute)
        CollectionItemsValidator::ArrayAttributeGetter.get(
          attribute,
          when_array: -> (attribute_name, index) { super(attribute_name)[index] },
          when_normal: -> { super }
        )
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ph_model-1.2.0 lib/active_model/validations/collection_items_validator/array_attribute_reader.rb
ph_model-1.1.3 lib/active_model/validations/collection_items_validator/array_attribute_reader.rb
ph_model-1.1.2 lib/active_model/validations/collection_items_validator/array_attribute_reader.rb
ph_model-1.1.1 lib/active_model/validations/collection_items_validator/array_attribute_reader.rb
ph_model-1.1.0 lib/active_model/validations/collection_items_validator/array_attribute_reader.rb
ph_model-1.0.2 lib/active_model/validations/collection_items_validator/array_attribute_reader.rb
ph_model-1.0.1 lib/active_model/validations/collection_items_validator/array_attribute_reader.rb
ph_model-1.0.0 lib/active_model/validations/collection_items_validator/array_attribute_reader.rb
ph_model-0.0.1 lib/active_model/validations/collection_items_validator/array_attribute_reader.rb