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
lifo (committer)
Tue Jul 29 04:39:21 -0700 2008
commit  7aaf1689dda863b72623f0e52ad87e2b739cb22b
tree    707d94cffa7d4c64e255c49d0826ef39ad41b6d3
parent  2cf161a384cc361d856aa76639bcb30570d67286
...
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