我正在构建Rails 5应用。
在此应用程序中,我创建一个具有customfields的用户。我从客户端(Javascript)获得的输出有点错误(我不知道如何更改)。如何将输出转换为必须具有的输出?
以下是我得到的
"user_customfields_attributes" => {
"1533038627616" => {
"customfield_id" => "1", "value" => "test 1"
}, "1533038627617" => {
"customfield_id" => "2", "value" => "test 2"
}
}
以下是我需要的
"user_customfields_attributes" => [{
"customfield_id" => 1,
"value" => "test 1"
}, {
"customfield_id" => 2,
"value" => "test 2"
}]
感谢所有帮助!