提交 38aafc03 编写于 作者: V Vipul A M

Remove `FormBuilder` deprecation warning about block argument and associated tests

上级 cd74f029
* Remove deprecated block passing to FormBuilder#new.
*Vipul A M*
* Pick `DateField` `DateTimeField` and `ColorField` values from stringified options allowing use of symbol keys with helpers.
*Jon Rowe*
......
......@@ -1237,11 +1237,7 @@ def to_model
self
end
def initialize(object_name, object, template, options, block=nil)
if block
ActiveSupport::Deprecation.warn "Giving a block to FormBuilder is deprecated and has no effect anymore."
end
def initialize(object_name, object, template, options)
@nested_child_index = {}
@object_name, @object, @template, @options = object_name, object, template, options
@default_options = @options ? @options.slice(:index, :namespace) : {}
......
......@@ -2916,18 +2916,6 @@ def test_fields_for_returns_block_result
assert_equal "fields", output
end
def test_form_builder_block_argument_deprecation
builder_class = Class.new(ActionView::Helpers::FormBuilder) do
def initialize(object_name, object, template, options, block)
super
end
end
assert_deprecated(/Giving a block to FormBuilder is deprecated and has no effect anymore/) do
builder_class.new(:foo, nil, nil, {}, proc {})
end
end
def test_form_for_only_instantiates_builder_once
initialization_count = 0
builder_class = Class.new(ActionView::Helpers::FormBuilder) do
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册