aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-30 08:46:22 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-30 08:46:22 +0000
commit98306bed054c320833d9d48229c68da10a38f3d0 (patch)
treebf39496a159a38974ea6e1016d1a92c0c3ec0b83 /actionpack/lib
parent14860ebe8226bd101531d8c0599035c9120cac4d (diff)
downloadrails-98306bed054c320833d9d48229c68da10a38f3d0.tar.gz
rails-98306bed054c320833d9d48229c68da10a38f3d0.tar.bz2
rails-98306bed054c320833d9d48229c68da10a38f3d0.zip
Fixed missing id uniqueness in FormTag#radio_button #1207 [Jarkko]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1253 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 4e25eee071..78f3f68830 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -175,6 +175,10 @@ module ActionView
options["type"] = "radio"
options["value"] = tag_value
options["checked"] = "checked" if value == tag_value
+ pretty_tag_value = tag_value.gsub(/\s/, "_").gsub(/\W/, "").downcase
+ options["id"] = @auto_index ?
+ "#{@object_name}_#{@auto_index}_#{@method_name}_#{pretty_tag_value}" :
+ "#{@object_name}_#{@method_name}_#{pretty_tag_value}"
add_default_name_and_id(options)
tag("input", options)
end