module Mongoid::Validatable::Macros
Public Instance Methods
validates_collection_size_of(*args)
click to toggle source
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
# File lib/custom_fields/extensions/mongoid/validatable/macros.rb, line 21 def validates_collection_size_of(*args) validates_with(Mongoid::Validatable::CollectionSizeValidator, _merge_attributes(args)) end