Allow symbols as name

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7151 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson
2007-06-28 22:27:11 +00:00
parent 8a207f6f22
commit 4d0780e9c7

View File

@@ -289,7 +289,7 @@ module ActionView
# # => <input checked="checked" class="color_input" id="color_green" name="color" type="radio" value="green" />
def radio_button_tag(name, value, checked = false, options = {})
pretty_tag_value = value.to_s.gsub(/\s/, "_").gsub(/(?!-)\W/, "").downcase
pretty_name = name.gsub(/\[/, "_").gsub(/\]/, "")
pretty_name = name.to_s.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