instance method validates_length_of

Ruby on Rails 7.1.6

Since v2.2.3

Available in: v2.2.3 v2.3.18 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

validates_length_of(*attr_names)

Validates that the specified attributes match the length restrictions supplied. If the attribute is an association, records that are marked for destruction are not counted.

See ActiveModel::Validations::HelperMethods.validates_length_of for more information.

Parameters

attr_names rest
Source
# File activerecord/lib/active_record/validations/length.rb, line 19
      def validates_length_of(*attr_names)
        validates_with LengthValidator, _merge_attributes(attr_names)
      end

Defined in activerecord/lib/active_record/validations/length.rb line 19 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Validations::ClassMethods

Type at least 2 characters to search.

↑↓ navigate · open · esc close