lib/mongoid/validatable/macros.rb in mongoid-7.3.5 vs lib/mongoid/validatable/macros.rb in mongoid-7.4.0
- old
+ new
@@ -1,7 +1,6 @@
# frozen_string_literal: true
-# encoding: utf-8
module Mongoid
module Validatable
module Macros
extend ActiveSupport::Concern
@@ -52,12 +51,10 @@
#
# validates_format_of :title, with: /\A[a-z0-9 \-_]*\z/i
# end
#
# @param [ Array ] args The names of the fields to validate.
- #
- # @since 2.4.0
def validates_format_of(*args)
validates_with(FormatValidator, _merge_attributes(args))
end
# Validates the length of a field.
@@ -69,12 +66,10 @@
#
# validates_length_of :title, minimum: 100
# end
#
# @param [ Array ] args The names of the fields to validate.
- #
- # @since 2.4.0
def validates_length_of(*args)
validates_with(LengthValidator, _merge_attributes(args))
end
# Validates whether or not a field is present - meaning nil or empty.
@@ -86,11 +81,9 @@
#
# validates_presence_of :title
# end
#
# @param [ Array ] args The names of the fields to validate.
- #
- # @since 2.4.0
def validates_presence_of(*args)
validates_with(PresenceValidator, _merge_attributes(args))
end
end
end