From c01014ac1c98a05fe68e652f978dfa9d43f0fc2b Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Wed, 27 Jan 2010 11:33:25 +0700 Subject: Modify the behavior of `radio_button_tag` to use `sanitize_to_id` for consistency [#1792 status:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- actionpack/lib/action_view/helpers/form_tag_helper.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'actionpack/lib/action_view/helpers/form_tag_helper.rb') diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 9b8471c6c6..ba1b0bcc20 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -329,9 +329,7 @@ module ActionView # radio_button_tag 'color', "green", true, :class => "color_input" # # => def radio_button_tag(name, value, checked = false, options = {}) - pretty_tag_value = value.to_s.gsub(/\s/, "_").gsub(/(?!-)\W/, "").downcase - 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 = { "type" => "radio", "name" => name, "id" => "#{sanitize_to_id(name)}_#{sanitize_to_id(value)}", "value" => value }.update(options.stringify_keys) html_options["checked"] = "checked" if checked tag :input, html_options end -- cgit v1.2.3