Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

There was a problem

You must be a member of this account.

This project is archived and is in readonly mode.

validate_length_of :maximum fails on nil/empty value

#2309

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.

Reported by Christopher Lee · March 21st, 2009 @ 07:21 PM

State: resolved
Milestone: none
Assigned to: nobody
Importance: none