Re: allow_nil does not

Tom Davies
Tue, 13 Sep 2005 19:21:38 -0000

I agree that it would be more intuitive to work that way.  However, I
doubt it will change since it would break backwards compatibility if
all of a sudden the empty string started getting through.  This might
also incorrectly set some properties to the empty string too.

Perhaps their should just be a nice method to convert the params to nil like:

for controllers parameters:

before_filter :empty_to_nil

for models attributes

before_validation :empty_to_nil

We could also add :only, and :except tags.  Not sure how useful this
sort of thing is for others though.

Tom

On 9/13/05, Nicholas Seckar
<nseckar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
> Tom Davies wrote:
>
> > Oh well... I will just grab it and nillify it before validation.
>
> Wouldn''t it be nice if validates_length_of validated the length of
the
> attached object if it was present and, if not, did nothing else?
>