method
validates_length_of
v5.0.0.1 -
Show latest stable
-
1 note -
Class: ActiveRecord::Validations::ClassMethods
- 1.0.0 (0)
- 1.1.6 (0)
- 1.2.6 (0)
- 2.0.3 (5)
- 2.1.0 (2)
- 2.2.1 (6)
- 2.3.8 (0)
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1 (-35)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
validates_length_of(*attr_names)
public
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.
Register or
log in
to add new notes.
sjmadsen -
March 13, 2010
3 thanks
Can be used with has_many associations
You can also use this to validate that a has_many association has a specified number of records on the other end:
has_many :members validates_length_of :members, :minimum => 1