Trouble using date_select with blank options

I want to allow users to enter a day and a month, but not necessarily
a year. i.e. it should be optional.

If I select the day and month, but a blank year and then submit i get:

1 error(s) on assignment of multiparameter attributes

The paramaters regarding the date look like this:

{“date_of_birth(2i)”=>“3”,
“date_of_birth(3i)”=>“17”,“date_of_birth(1i)”=>""}

My select looks like this:

<%= date_select ‘contact’, ‘date_of_birth’, :order => [:day, :month,
:year], :include_blank => true %>

There’s no validation in the model and the databse field is set to
allow null values.

If someone could help me out here it would be most appreciated,
Thanks,
Paul.

Paul S. wrote:

“date_of_birth(3i)”=>“17”,“date_of_birth(1i)”=>""}

My select looks like this:

<%= date_select ‘contact’, ‘date_of_birth’, :order => [:day, :month,
:year], :include_blank => true %>

You can only use date_select to set a model attribute to a
fully-specified
date. You’ll have to use select_date instead, and write a method in
your Contact model to handle setting the correct attribute values from
the
incoming posted parameters.


We develop, watch us RoR, in numbers too big to ignore.