This project is archived and is in readonly mode.

#1993 ✓resolved
David Stevenson

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

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>

Referenced by

Pages