Fixed that form elements would strip the trailing [] from the first parameter...

Fixed that form elements would strip the trailing [] from the first parameter (closes #3545) [ruby@bobsilva.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 06dd7b8e
*SVN*
* Fixed that form elements would strip the trailing [] from the first parameter #3545 [ruby@bobsilva.com]
* During controller resolution, update the NameError suppression to check for the expected constant. [Nicholas Seckar]
* Update script.aculo.us to V1.5.3 [Thomas Fuchs]
......
......@@ -231,7 +231,7 @@ class InstanceTag #:nodoc:
DEFAULT_DATE_OPTIONS = { :discard_type => true }.freeze unless const_defined?(:DEFAULT_DATE_OPTIONS)
def initialize(object_name, method_name, template_object, local_binding = nil, object = nil)
@object_name, @method_name = object_name.to_s, method_name.to_s
@object_name, @method_name = object_name.to_s.dup, method_name.to_s.dup
@template_object, @local_binding = template_object, local_binding
@object = object
if @object_name.sub!(/\[\]$/,"")
......
......@@ -68,6 +68,13 @@ def test_text_field_assuming_size
assert_dom_equal expected, text_field("post", "title", :maxlength => 35)
end
def test_text_field_doesnt_change_param_values
object_name = 'post[]'
expected = '<input id="post_123_title" name="post[123][title]" size="30" type="text" value="Hello World" />'
assert_equal expected, text_field(object_name, "title")
assert_equal object_name, "post[]"
end
def test_check_box
assert_dom_equal(
'<input checked="checked" id="post_secret" name="post[secret]" type="checkbox" value="1" /><input name="post[secret]" type="hidden" value="0" />',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册