aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb2
-rw-r--r--actionpack/test/template/form_helper_test.rb9
3 files changed, 11 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index d720370f24..d233a67d78 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Don't interpret the :value option on text_area as an html attribute. Set the text_area's value. #3752 [gabriel@gironda.org]
+
* Fix remote_form_for creates a non-ajax form. [Rick Olson]
* Don't let arbitrary classes match as controllers -- a potentially dangerous bug. [Nicholas Seckar]
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 9473b59563..43770eec8d 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -277,7 +277,7 @@ module ActionView
def to_text_area_tag(options = {})
options = DEFAULT_TEXT_AREA_OPTIONS.merge(options.stringify_keys)
add_default_name_and_id(options)
- content_tag("textarea", html_escape(value_before_type_cast), options)
+ content_tag("textarea", html_escape(options.delete('value') || value_before_type_cast), options)
end
def to_check_box_tag(options = {}, checked_value = "1", unchecked_value = "0")
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index a922584370..83d50aae7a 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -126,7 +126,14 @@ class FormHelperTest < Test::Unit::TestCase
text_area("post", "body")
)
end
-
+
+ def test_text_area_with_alternate_value
+ assert_dom_equal(
+ '<textarea cols="40" id="post_body" name="post[body]" rows="20">Testing alternate values.</textarea>',
+ text_area("post", "body", :value => 'Testing alternate values.')
+ )
+ end
+
def test_date_selects
assert_dom_equal(
'<textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',