diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-09-03 19:32:31 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-09-03 19:32:31 +0000 |
commit | 4fc6c872ef1f6ae10eec7c24cbc60697336ca707 (patch) | |
tree | 4adb364ba265275c82fc797d13c9ac96edd1848c /actionpack/lib | |
parent | fef2d880a5244516e4891014ffb6bca3d7283272 (diff) | |
download | rails-4fc6c872ef1f6ae10eec7c24cbc60697336ca707.tar.gz rails-4fc6c872ef1f6ae10eec7c24cbc60697336ca707.tar.bz2 rails-4fc6c872ef1f6ae10eec7c24cbc60697336ca707.zip |
radio_button_tag generates unique id attributes. Closes #3353.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4925 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_tag_helper.rb | 3 |
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 816f1064f7..e023fe93d2 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -125,7 +125,8 @@ module ActionView # Creates a radio button. def radio_button_tag(name, value, checked = false, options = {}) - html_options = { "type" => "radio", "name" => name, "id" => name, "value" => value }.update(options.stringify_keys) + 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) html_options["checked"] = "checked" if checked tag :input, html_options end |