This project is archived and is in readonly mode.

#2457 ✓duplicate
Nolan Eakins

[PATCH] time_select ..., :include_blank => true

Reported by Nolan Eakins | April 8th, 2009 @ 05:08 PM | in 3.x

I'm running into issues with time_select raising MultiparameterAssignmentErrors. It's very similar to the email quoted below (http://markmail.org/message/lkzm...)

Hello everyone,

I'm having issues with a "time" field in a model. On the view, I use a time_select helper to generate the select for this field, and since I need this field to be NULL sometimes, I include the option :include_blank => true, like this:

<%= time_select 'support', 'duration', :minute_step => 15, :include_blank => true %>

The problem is that when I use :include_blank, the generated select comes with the hidden fields (of year, month and day) empty, like this:

00 01 02 03 21 22 23 : 00 15 30 45

And so, when I submit the form with the time field filled, I get an ActiveRecord::MultiparameterAssignmentErrors. If I don't set the option :include_blank => true, the hidden fields for year, month and day come filled with the respective current values, which are ignored by MySQL since we're storing them in a time field, not a datetime, and the insert or update goes on fine.

Is this a Rails bug (i'm using version 1.2.2) or am I doing something wrong here?

Thanks, Rodrigo.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages