Permalink
Browse files

Fixed that FormHelper#radio_button would produce invalid ids (closes #…

…11298) [harlancrystal]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9088 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 123f5a3 commit b0bfcca16efff329e0cfaebc18a7debed126473b @dhh dhh committed Mar 24, 2008
View
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that FormHelper#radio_button would produce invalid ids #11298 [harlancrystal]
+
* Added :confirm option to submit_tag #11415 [miloops]
* Fixed NumberHelper#number_with_precision to properly round in a way that works equally on Mac, Windows, Linux (closes #11409, #8275, #10090, #8027) [zhangyuanyi]
@@ -498,8 +498,8 @@ def to_radio_button_tag(tag_value, options = {})
options["checked"] = "checked" if checked
pretty_tag_value = tag_value.to_s.gsub(/\s/, "_").gsub(/\W/, "").downcase
options["id"] ||= defined?(@auto_index) ?
- "#{@object_name}_#{@auto_index}_#{@method_name}_#{pretty_tag_value}" :
- "#{@object_name}_#{@method_name}_#{pretty_tag_value}"
+ "#{tag_id_with_index(@auto_index)}_#{pretty_tag_value}" :
+ "#{tag_id}_#{pretty_tag_value}"
add_default_name_and_id(options)
tag("input", options)
end
@@ -187,6 +187,9 @@ def test_radio_button
assert_dom_equal('<input id="post_title_goodbye_world" name="post[title]" type="radio" value="Goodbye World" />',
radio_button("post", "title", "Goodbye World")
)
+ assert_dom_equal('<input id="item_subobject_title_inside_world" name="item[subobject][title]" type="radio" value="inside world"/>',
+ radio_button("item[subobject]", "title", "inside world")
+ )
end
def test_radio_button_is_checked_with_integers

0 comments on commit b0bfcca

Please sign in to comment.