The default is "is too long (maximum is %d characters)".
validates_length_of(:first_name, :maximum => 35, :message => "is just too long")
The :is operation checks whether the length of the attribute exactly matches the specified
length. Either :message or :wrong_length can be used to customize the error message
when this check is used. The default is "is the wrong length (should be %d characters)".
validates_length_of(:first_name,
:is => 35,
:message => "must be exactly 35 characters long")
The :within operation checks whether the length of the attribute falls within the specified
range. The options :too_long and :too_short should be used to customize the error messages
when this check is used. The defaults are "is too long (maximum of %d characters)" and "is
too short (minimum of %d characters)", respectively.
validates_length_of(:first_name,
:within => 5...35,
:too_short => "is too short",
:too_long => "is too long")
The other valid configuration options for this method are :on, :allow_nil, and :if.
The :on option specifies for what methods this validation should be active.
Pages:
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570