Search code examples
ruby-on-railsformsdatetime-selectmultiparameter

What Does ActiveRecord::MultiparameterAssignmentErrors Mean?


I have a rails form with a datetime_select field. When I try to submit the form, I get the following exception:

ActiveRecord::MultiparameterAssignmentErrors in WidgetsController#update 
1 error(s) on assignment of multiparameter attributes

If it's a validation error, why don't I see an error on the page?

This is in Rails 2.0.2


Solution

  • It turns out that rails uses something called Multi-parameter assignment to transmit dates and times in small parts that are reassembled when you assign params to the model instance.

    My problem was that I was using a datetime_select form field for a date model field. It apparently chokes when the multi-parameter magic tries to set the time on a Date object.

    The solution was to use a date_select form field rather than a datetime_select.