This project is archived and is in readonly mode.
validate_length_of :maximum fails on nil/empty value
Reported by Christopher Lee | March 21st, 2009 @ 07:21 PM
forgive me as I'm new to rails bugtracking.
the last bug I saw opened was http://dev.rubyonrails.org/ticke..., which was open and is still unresolved.
but when using validates_length_of, and :maximum, if the value of the field is blank, rails throws an activerecord error "field is too long".
the only way to get around it is to also specify
:allow_nil => true, :allow_blank => true
Which, to me, shouldn't be necessary.
The strange thing is that the test in active record does not produce this problem. I would be happy to look into it if this is a known problem still.
Comments and changes to this ticket
-
CancelProfileIsBroken August 5th, 2009 @ 03:43 PM
- Tag set to bugmash
-
Zac Williams August 6th, 2009 @ 02:29 AM
- Tag changed from bugmash to bugmash, patch, tested
Created a patch to fix this.
-
Repository August 8th, 2009 @ 07:09 PM
(from [5ab94b2595836fe2de36fd632ba9577c459b1292]) validates_length_of with maximum should allow nil [#2309 status:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/5ab94b2595836fe2de36fd632ba957... -
CancelProfileIsBroken August 8th, 2009 @ 08:36 PM
- State changed from new to resolved
-
CancelProfileIsBroken August 8th, 2009 @ 11:07 PM
- Tag changed from bugmash, patch, tested to patch, tested
- Milestone cleared.
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>
People watching this ticket
Attachments
Referenced by
- 2309 validate_length_of :maximum fails on nil/empty value (from [5ab94b2595836fe2de36fd632ba9577c459b1292]) validat...