Date_select and impossible dates

hi,

using date_select right from a generated scaffold code leads to an
error if an impossible date is selected (like the 31 of february)

can’t get a way to correct this via a validation…
in fact that make sens because in the model i have the ‘dateofbirth’
object which is a date object…

so providing an impossible day-month-year trio leads to an impossible
creation of the date object…

anyone with a solution?

thanks

I solved this problem by catching the error and displaying it to the
user.
Something similar to the following (off the top of my head, not really
looking at code at the moment):

begin
if mymodel.save
# everything ok

else
flash[:warning] = “error saving object”
end
rescue => e
flash[:warning] = e
end
render :action=>‘new’ and return if flash[:warning]
redirect_to :action=>‘show’, :id=>mymodel.id