This project is archived and is in readonly mode.
allow_blank => false can be ineffective on validates_length_of
Reported by Jacob Williams | October 25th, 2010 @ 05:49 PM
(2.3.10)
I expected
validates_length_of :foo, :maximum => 10, :allow_blank => false
to prohibit empty strings, but it doesn't. If this is the desired behavior it would be helpful for the docs to make it clear (for instance, "Note: setting :allow_blank to false will not cause this validation to fail if it would otherwise pass.")
Comments and changes to this ticket
-
Andrew White October 26th, 2010 @ 10:43 AM
- State changed from new to wontfix
- Importance changed from to Low
The documentation explicitly states that the validation will be skipped if the value is blank so it follows that the validation will not be skipped if the value is not blank. Feel free to check out the docrails project if you think the documentation could be improved.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>