diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index 07cc62a52717ef8b3dab5ce406011b6e0c0f1b38..5933be25759f6e10e50384ad2b59c59a11c3642d 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -47,7 +47,7 @@ def end_form_tag
# Options:
# * :multiple - If set to true the selection will allow multiple choices.
def select_tag(name, option_tags = nil, options = {})
- content_tag("select", option_tags, { "name" => name, "id" => name }.update(options))
+ content_tag("select", option_tags, { "name" => name, "id" => name }.update(options.stringify_keys))
end
# Creates a standard text field.
@@ -59,7 +59,7 @@ def select_tag(name, option_tags = nil, options = {})
#
# A hash of standard HTML options for the tag.
def text_field_tag(name, value = nil, options = {})
- tag("input", { "type" => "text", "name" => name, "id" => name, "value" => value }.update(options))
+ tag("input", { "type" => "text", "name" => name, "id" => name, "value" => value }.update(options.stringify_keys))
end
# Creates a hidden field.
@@ -103,33 +103,33 @@ def text_area_tag(name, content = nil, options = {})
options.delete("size")
end
- content_tag("textarea", content, { "name" => name, "id" => name }.update(options))
+ content_tag("textarea", content, { "name" => name, "id" => name }.update(options.stringify_keys))
end
# Creates a check box.
def check_box_tag(name, value = "1", checked = false, options = {})
- html_options = { "type" => "checkbox", "name" => name, "id" => name, "value" => value }.update(options)
+ html_options = { "type" => "checkbox", "name" => name, "id" => name, "value" => value }.update(options.stringify_keys)
html_options["checked"] = "checked" if checked
tag("input", html_options)
end
# 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)
+ html_options = { "type" => "radio", "name" => name, "id" => name, "value" => value }.update(options.stringify_keys)
html_options["checked"] = "checked" if checked
tag("input", html_options)
end
# Creates a submit button with the text value as the caption.
def submit_tag(value = "Save changes", options = {})
- tag("input", { "type" => "submit", "name" => "commit", "value" => value }.update(options))
+ tag("input", { "type" => "submit", "name" => "commit", "value" => value }.update(options.stringify_keys))
end
# Displays an image which when clicked will submit the form.
#
# source is passed to AssetTagHelper#image_path
def image_submit_tag(source, options = {})
- tag("input", { "type" => "image", "src" => image_path(source) }.update(options))
+ tag("input", { "type" => "image", "src" => image_path(source) }.update(options.stringify_keys))
end
end
end
diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb
index 1fc84744e820c0070ecdcc0f4a0a3cd2a3e3543b..546d3e6772e522440ecafec1204ba766817d940d 100644
--- a/actionpack/test/template/form_tag_helper_test.rb
+++ b/actionpack/test/template/form_tag_helper_test.rb
@@ -87,5 +87,11 @@ def test_boolean_optios
assert_dom_equal %(), select_tag("people", "", :multiple => true)
assert_dom_equal %(), select_tag("people", "", :multiple => nil)
end
+
+ def test_stringify_symbol_keys
+ actual = text_field_tag "title", "Hello!", :id => "admin"
+ expected = %()
+ assert_dom_equal expected, actual
+ end
end