:allow_nil validation vs. blank?

I think I must be doing something wrong... when a form returns params
to the controller, empty fields appear to be returned as blank, not
nil. so what's the point of an :allow_nil=>true setting on a
validation? it fails because blank is not the same as nil.

i would expect either returned empty fields to be nil, or :allow_nil
to really be :allow_blank. otherwise i have to do a search through
params every time i do a create/update to convert blank to nil.
totally unrailslike. someone straighten me out please...

thx - mike

I think I must be doing something wrong... when a form returns params
to the controller, empty fields appear to be returned as blank, not
nil. so what's the point of an :allow_nil=>true setting on a
validation? it fails because blank is not the same as nil.

I haven't ever found it useful either. I use an :if => Proc.new {}
when I need optional validation.

i would expect either returned empty fields to be nil, or :allow_nil
to really be :allow_blank. otherwise i have to do a search through
params every time i do a create/update to convert blank to nil.
totally unrailslike. someone straighten me out please...

You might try using :default => nil in your migrations where
appropriate. Blank values appear as NULL in the database for me when
I do that.