diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 3 | ||||
-rw-r--r-- | actionpack/test/template/form_tag_helper_test.rb | 3 |
3 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 16c9b0add8..1e270475ea 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed that radio_button_tag should generate unique ids #3353 [BobSilva/rebecca/josh] + * Fixed that HTTP authentication should work if the header is called REDIRECT_X_HTTP_AUTHORIZATION as well #6754 [mislaw] * Don't mistakenly interpret the request uri as the query string. #8731 [lifofifo, Jeremy Kemper] diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index a230c28a68..5b5dace5ee 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -122,7 +122,8 @@ module ActionView # Creates a radio button. def radio_button_tag(name, value, checked = false, options = {}) pretty_tag_value = value.to_s.gsub(/\s/, "_").gsub(/(?!-)\W/, "").downcase - html_options = { "type" => "radio", "name" => name, "id" => "#{name}_#{pretty_tag_value}", "value" => value }.update(options.stringify_keys) + pretty_name = name.gsub(/\[/, "_").gsub(/\]/, "") + html_options = { "type" => "radio", "name" => name, "id" => "#{pretty_name}_#{pretty_tag_value}", "value" => value }.update(options.stringify_keys) html_options["checked"] = "checked" if checked tag :input, html_options end diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index cb78a59516..5e89cbbd54 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -93,6 +93,9 @@ class FormTagHelperTest < Test::Unit::TestCase expected = %(<input id="opinion_-1" name="opinion" type="radio" value="-1" /><input id="opinion_1" name="opinion" type="radio" value="1" />) assert_dom_equal expected, actual + actual = radio_button_tag("person[gender]", "m") + expected = %(<input id="person_gender_m" name="person[gender]" type="radio" value="m" />) + assert_dom_equal expected, actual end def test_select_tag |