我想使用表单上的两个元素更新日期时间属性:text_field 和 time_select。这将使用户能够使用 datepicker (jquery ui) 选择日期,并使用下拉菜单选择时间:
但是,当我尝试更新我的表单时,我收到以下错误:
ActiveRecord::MultiparameterAssignmentErrors in StepsController#update
1 error(s) on assignment of multiparameter attributes
Parameters:
{"utf8"=>"✓",
"_method"=>"put",
"authenticity_token"=>"FxFbv9OFzCiYjNknZKUtwyAXR99uuOvy8uplv1cKaZE=",
"step"=>{"description"=>"<p>Project description</p>\r\n",
"published_on"=>"05/30/2013",
"published_on(4i)"=>"15",
"published_on(5i)"=>"19"},
"commit"=>"Update Step",
"project_id"=>"92",
"id"=>"0"}
如何将 text_field 和 time_select 中的参数组合成一个日期时间?
这是我的表格:
<%= f.text_field :published_on, :value=> (@step.published_on.strftime("%m/%d/%Y")) %> at <%= f.time_select :published_on, :class=>"btn dropdown-toggle", :ampm=> true, :ignore_date=>true %>