Sha256: b6e92de54353d8cefda8d987113658a93f4a3b169693928c7ba792a9b52a37ed

Contents?: true

Size: 612 Bytes

Versions: 12

Compression:

Stored size: 612 Bytes

Contents

module Mongoid
  module Validations
    module Macros
      extend ActiveSupport::Concern

      # Validates the size of a collection.
      #
      # @example
      #   class Person
      #     include Mongoid::Document
      #     has_many :addresses
      #
      #     validates_collection_size_of :addresses, minimum: 1
      #   end
      #
      # @param [ Array ] args The names of the fields to validate.
      #
      # @since 2.4.0
      def validates_collection_size_of(*args)
        validates_with(Mongoid::Validations::CollectionSizeValidator, _merge_attributes(args))
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
custom_fields-2.3.4 lib/custom_fields/extensions/mongoid/validations/macros.rb
custom_fields-2.3.3 lib/custom_fields/extensions/mongoid/validations/macros.rb
custom_fields-2.3.2 lib/custom_fields/extensions/mongoid/validations/macros.rb
gnuside-custom_fields-2.3.2.2 lib/custom_fields/extensions/mongoid/validations/macros.rb
gnuside-custom_fields-2.3.2 lib/custom_fields/extensions/mongoid/validations/macros.rb
gnuside-custom_fields-2.3.1.1 lib/custom_fields/extensions/mongoid/validations/macros.rb
gnuside-custom_fields-2.3.1 lib/custom_fields/extensions/mongoid/validations/macros.rb
custom_fields-2.3.1 lib/custom_fields/extensions/mongoid/validations/macros.rb
custom_fields-2.3.0 lib/custom_fields/extensions/mongoid/validations/macros.rb
custom_fields-2.2.3 lib/custom_fields/extensions/mongoid/validations/macros.rb
custom_fields-2.2.2 lib/custom_fields/extensions/mongoid/validations/macros.rb
custom_fields-2.2.1 lib/custom_fields/extensions/mongoid/validations/macros.rb