What Does ActiveRecord::MultiparameterAssignmentEr

2019-01-23 14:50发布

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

7条回答
贼婆χ
2楼-- · 2019-01-23 15:43

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.

查看更多
登录 后发表回答