Join GitHub today
link_to_add and radio buttons #178
I am having a problem in a nested form with radio button fields (the field is a boolean in the collection where only one of the members should be true).
My code to render the radio button inside the nested_form_for is:
(if I use the usual form_for syntax and call radio_button on the nested_form_for object, the radio button does not behave like a radio button in that checking on does not uncheck the others)
Now usually when the user clicks one of the radio buttons to change the selected item the id of the new item is sent in the params, so it's fine. But...on new items that are added at runtime with link_to_add, there is no id to send, so all that is sent is:
"correct_distractor" => "on"
So can someone explain to me the proper way to implement radio buttons in a nested form when only one element of the collection should have the value turned on?