Skip to content

Commit 3278a40

Browse files
committed
Add missing text_area alias in Action View FormHelper
Followup: rails#52467
1 parent 38bc323 commit 3278a40

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

actionview/lib/action_view/helpers/form_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,6 +2035,7 @@ def #{selector}(method, options = {}) # def text_field(method, options = {})
20352035
end
20362036
end
20372037
end
2038+
alias_method :text_area, :textarea
20382039

20392040
# Creates a scope around a specific model object like form_with, but
20402041
# doesn't create the form tags themselves. This makes fields_for suitable

actionview/test/template/form_helper_test.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,19 @@ def test_form_for
16441644
assert_dom_equal expected, @rendered
16451645
end
16461646

1647+
1648+
def test_form_for_text_area_alias
1649+
form_for(@post, html: { id: "create-post" }) do |f|
1650+
concat f.text_area(:body)
1651+
end
1652+
1653+
expected = whole_form("/posts/123", "create-post", "edit_post", method: "patch") do
1654+
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" \
1655+
end
1656+
1657+
assert_dom_equal expected, @rendered
1658+
end
1659+
16471660
def test_form_for_is_not_affected_by_form_with_generates_ids
16481661
old_value = ActionView::Helpers::FormHelper.form_with_generates_ids
16491662
ActionView::Helpers::FormHelper.form_with_generates_ids = false

0 commit comments

Comments
 (0)