【发布时间】:2013-10-29 21:11:52
【问题描述】:
我正在使用一些教程来构建一些具有嵌套属性的复杂表单(project 模型及其嵌套属性tags)。问题是标签。我有这些输入:
<input id="project_title" name="project[title]" type="text">
和
<input id="project_tags_attributes_1383080749618_pill" name="project[tags_attributes][1383080749618][pill]" type="text" placeholder="add a tag" style="display: none;">
但提交表单时没有设置标签属性。我的日志中有参数:
{"utf8"=>"✓", "authenticity_token"=>"4wly3xgZ3ge6pEc8pJAV0XPGbex0WJKoaQ8lVaoDNNA=", "project"=>{"title"=>"some_project", "tags_attributes"=>{"1383080749618"=>{"pill"=>""}}, "description"=>"descriptor"}, "commit"=>"Create project"}
奇怪的是,当我在我的 chrome 控制台中检查药丸的标签属性值时,就在提交之前,我得到了一个正确的非 null 值……怎么可能
【问题讨论】:
-
你在使用 rails 4 吗?
标签: ruby-on-rails ruby forms nested-attributes