Skip to content
Browse files

Fix that label_tag doesn't take a symbol for a name. [#719 state:reso…

…lved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
1 parent 5f732b9 commit 2752cebb8b707989c13e45be7d62b77196c42b91 @DefV DefV committed with tarmo
View
2 actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -129,7 +129,7 @@ def text_field_tag(name, value = nil, options = {})
# label_tag 'name', nil, :class => 'small_label'
# # => <label for="name" class="small_label">Name</label>
def label_tag(name, text = nil, options = {})
- content_tag :label, text || name.humanize, { "for" => name }.update(options.stringify_keys)
+ content_tag :label, text || name.to_s.humanize, { "for" => name }.update(options.stringify_keys)
end
# Creates a hidden form input field used to transmit data that would be lost due to HTTP's statelessness or
View
6 actionpack/test/template/form_tag_helper_test.rb
@@ -190,6 +190,12 @@ def test_label_tag_without_text
assert_dom_equal expected, actual
end
+ def test_label_tag_with_symbol
+ actual = label_tag :title
+ expected = %(<label for="title">Title</label>)
+ assert_dom_equal expected, actual
+ end
+
def test_label_tag_with_text
actual = label_tag "title", "My Title"
expected = %(<label for="title">My Title</label>)

0 comments on commit 2752ceb

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