aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-06-23 16:58:31 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-06-23 16:58:31 +0000
commit62a9203a5ed43fb3aea742b887a3bc874352950a (patch)
treef523c6594178ed803a092d51637cfa0e8425e3b8 /actionpack/lib/action_view/helpers
parent46b0e7d1d77c77d013235e3bf99d1afb89513cc9 (diff)
downloadrails-62a9203a5ed43fb3aea742b887a3bc874352950a.tar.gz
rails-62a9203a5ed43fb3aea742b887a3bc874352950a.tar.bz2
rails-62a9203a5ed43fb3aea742b887a3bc874352950a.zip
Fixed that radio_button_tag should generate unique ids (closes #3353) [BobSilva/rebecca/josh]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7093 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb3
1 files changed, 2 insertions, 1 deletions
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