public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Fix that label_tag doesn't take a symbol for a name. [#719 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
DefV (author)
Tue Jul 29 04:11:38 -0700 2008
Tarmo Tänav (committer)
Sun Aug 24 09:36:31 -0700 2008
commit  2752cebb8b707989c13e45be7d62b77196c42b91
tree    92b539f80a6488c570b8b1ed1da25837ced369ed
parent  5f732b93ac4f56b4ae00b81d3dc39f0e93e63b85
...
129
130
131
132
 
133
134
135
...
129
130
131
 
132
133
134
135
0
@@ -129,7 +129,7 @@ module ActionView
0
       #   label_tag 'name', nil, :class => 'small_label'
0
       #   # => <label for="name" class="small_label">Name</label>
0
       def label_tag(name, text = nil, options = {})
0
-        content_tag :label, text || name.humanize, { "for" => name }.update(options.stringify_keys)
0
+        content_tag :label, text || name.to_s.humanize, { "for" => name }.update(options.stringify_keys)
0
       end
0
 
0
       # Creates a hidden form input field used to transmit data that would be lost due to HTTP's statelessness or
...
190
191
192
 
 
 
 
 
 
193
194
195
...
190
191
192
193
194
195
196
197
198
199
200
201
0
@@ -190,6 +190,12 @@ class FormTagHelperTest < ActionView::TestCase
0
     assert_dom_equal expected, actual
0
   end
0
 
0
+  def test_label_tag_with_symbol
0
+    actual = label_tag :title
0
+    expected = %(<label for="title">Title</label>)
0
+    assert_dom_equal expected, actual
0
+  end
0
+
0
   def test_label_tag_with_text
0
     actual = label_tag "title", "My Title"
0
     expected = %(<label for="title">My Title</label>)

Comments