This project is archived and is in readonly mode.

f.radio_button ignores parent fields_for's :index option
Reported by David Stevenson | February 16th, 2009 @ 09:30 PM | in 2.x
The following view code does not work as expected:
fields_for @post, :index => 1 do |f|
f.radio_button :title, "Hello"
end
The ID of the radio button generated was not
post_1_title_hello
, instead was
post_title_hello
. This is because the logic for
generating radio button IDs does not rely on the logic for
generating the rest of the IDs. It instead completely replaces
it.
In my patch, I generate IDs for radio_buttons similarly to
everything else and then add on the _value
part of the
ID (unless override by the user).
Comments and changes to this ticket
-
Zach Brock February 17th, 2009 @ 05:59 PM
- Tag changed from “fields_for, form_for, form_helper, index, radio_button” to “fields_for, form_for, form_helper, index, patch, radio_button”
+1
-
-
-
Michael Koziarski March 2nd, 2009 @ 05:43 AM
- Assigned user set to “Michael Koziarski”
This looks good to me, can you combine it with #1992 and upload it here.
I realise they're different reports, but the patches clash with one another, so best to just do it in one git apply :)
-
David Stevenson March 11th, 2009 @ 04:32 PM
- Tag set to “form_helper, label_tag, patch, radio_button_tag”
Koz,
Attached patch should fix both issues... and complete with tests.
-
-
Michael Koziarski June 9th, 2009 @ 09:30 AM
- State changed from “new” to “resolved”
-
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
-
1992 f.label should work for targeting f.radio_button this isn't strictly a 'duplicate' of #1993, but the two p...
-
2392 to_radio_button_tag ignores :index options partially Actually, this appears to be the same as #1993. I would s...
-
2392 to_radio_button_tag ignores :index options partially Actually, this appears to be the same as #1993. I would s...
-
2392 to_radio_button_tag ignores :index options partially https://rails.lighthouseapp.com/projects/8994/tickets/19...
-
2392 to_radio_button_tag ignores :index options partially Actually #1993 was already applied and introduced this bu...