Skip to content
This repository
Browse code

Make xyz_tag(..., :id => "foo") work again

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2535 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 8946804b8a73242ac59296782741fec2fb08e97a 1 parent 6fe5f65
Jamis Buck authored October 12, 2005
14  actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -47,7 +47,7 @@ def end_form_tag
47 47
       # Options:
48 48
       # * <tt>:multiple</tt> - If set to true the selection will allow multiple choices.
49 49
       def select_tag(name, option_tags = nil, options = {})
50  
-        content_tag("select", option_tags, { "name" => name, "id" => name }.update(options))
  50
+        content_tag("select", option_tags, { "name" => name, "id" => name }.update(options.stringify_keys))
51 51
       end
52 52
 
53 53
       # Creates a standard text field.
@@ -59,7 +59,7 @@ def select_tag(name, option_tags = nil, options = {})
59 59
       # 
60 60
       # A hash of standard HTML options for the tag.
61 61
       def text_field_tag(name, value = nil, options = {})
62  
-        tag("input", { "type" => "text", "name" => name, "id" => name, "value" => value }.update(options))
  62
+        tag("input", { "type" => "text", "name" => name, "id" => name, "value" => value }.update(options.stringify_keys))
63 63
       end
64 64
 
65 65
       # Creates a hidden field.
@@ -103,33 +103,33 @@ def text_area_tag(name, content = nil, options = {})
103 103
           options.delete("size")
104 104
         end
105 105
 
106  
-        content_tag("textarea", content, { "name" => name, "id" => name }.update(options))
  106
+        content_tag("textarea", content, { "name" => name, "id" => name }.update(options.stringify_keys))
107 107
       end
108 108
 
109 109
       # Creates a check box.
110 110
       def check_box_tag(name, value = "1", checked = false, options = {})
111  
-        html_options = { "type" => "checkbox", "name" => name, "id" => name, "value" => value }.update(options)
  111
+        html_options = { "type" => "checkbox", "name" => name, "id" => name, "value" => value }.update(options.stringify_keys)
112 112
         html_options["checked"] = "checked" if checked
113 113
         tag("input", html_options)
114 114
       end
115 115
 
116 116
       # Creates a radio button.
117 117
       def radio_button_tag(name, value, checked = false, options = {})
118  
-        html_options = { "type" => "radio", "name" => name, "id" => name, "value" => value }.update(options)
  118
+        html_options = { "type" => "radio", "name" => name, "id" => name, "value" => value }.update(options.stringify_keys)
119 119
         html_options["checked"] = "checked" if checked
120 120
         tag("input", html_options)
121 121
       end
122 122
 
123 123
       # Creates a submit button with the text <tt>value</tt> as the caption.
124 124
       def submit_tag(value = "Save changes", options = {})
125  
-        tag("input", { "type" => "submit", "name" => "commit", "value" => value }.update(options))
  125
+        tag("input", { "type" => "submit", "name" => "commit", "value" => value }.update(options.stringify_keys))
126 126
       end
127 127
       
128 128
       # Displays an image which when clicked will submit the form.
129 129
       #
130 130
       # <tt>source</tt> is passed to AssetTagHelper#image_path
131 131
       def image_submit_tag(source, options = {})
132  
-        tag("input", { "type" => "image", "src" => image_path(source) }.update(options))
  132
+        tag("input", { "type" => "image", "src" => image_path(source) }.update(options.stringify_keys))
133 133
       end
134 134
     end
135 135
   end
6  actionpack/test/template/form_tag_helper_test.rb
@@ -87,5 +87,11 @@ def test_boolean_optios
87 87
     assert_dom_equal %(<select id="people" multiple="multiple" name="people"><option>david</option></select>), select_tag("people", "<option>david</option>", :multiple => true)
88 88
     assert_dom_equal %(<select id="people" name="people"><option>david</option></select>), select_tag("people", "<option>david</option>", :multiple => nil)
89 89
   end
  90
+
  91
+  def test_stringify_symbol_keys
  92
+    actual = text_field_tag "title", "Hello!", :id => "admin"
  93
+    expected = %(<input id="admin" name="title" type="text" value="Hello!" />)
  94
+    assert_dom_equal expected, actual
  95
+  end
90 96
 end
91 97
 

0 notes on commit 8946804

Please sign in to comment.
Something went wrong with that request. Please try again.