Test fails with :allow_blank and :allow_nil are true
Reported by Karl Smith | February 7th, 2008 @ 01:51 PM
In model:
validates_length_of :middle_initial, :is => 1, :allow_blank => true
Will fail test with:
should_ensure_length_in_range :middle_initial, (1..1)
should_ensure_length_in_range :middle_initial, (0..1)
Reason:
should_ensure_length_in_range will test the attribute with a zero length string, which is valid when :allow_blank is set to true. And skips lengths less than zero, as in the second case.
Comments and changes to this ticket
-

carlivar June 5th, 2008 @ 08:08 PM
should_require_unique_attributes also fails with :allow_nil => true
-
Tammer Saleh June 26th, 2008 @ 04:10 PM
- → State changed from new to needs-git-fork
- → Assigned user cleared.
- → Tag changed from to should_require_unique_attributes
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
