我正在尝试将单选按钮和text_field组合为单个值:
= f.radio_button :system, "bacteria"
Bacteria
= f.radio_button :system, "mammalian"
Mammalian
= f.radio_button :system, "yeast"
Yeast
= f.radio_button :system, "insect"
Insect
= f.radio_button :system, "other"
Other:
= f.text_field :system, class:"input-small"
Run Code Online (Sandbox Code Playgroud)
当我提交时,没有任何反应,因为即使检查了无线电,我也会在参数中给出空白值(我认为它考虑了文本字段).
我试图给text_field另一个名字,并在更新后替换控制器中的:system值,但它看起来像一个脏的方式......
你有更干净的想法吗?