call capture
fewer times from form_for
This commit is contained in:
parent
8899503f62
commit
e2a97adbae
@ -434,7 +434,8 @@ def form_for(record, options = {}, &block)
|
||||
output = capture(builder, &block)
|
||||
html_options[:multipart] ||= builder.multipart?
|
||||
|
||||
form_tag(options[:url] || {}, html_options) { output }
|
||||
html_options = html_options_for_form(options[:url] || {}, html_options)
|
||||
form_tag_with_body(html_options, output)
|
||||
end
|
||||
|
||||
def apply_form_for_options!(record, object, options) #:nodoc:
|
||||
|
@ -67,7 +67,7 @@ module FormTagHelper
|
||||
def form_tag(url_for_options = {}, options = {}, &block)
|
||||
html_options = html_options_for_form(url_for_options, options)
|
||||
if block_given?
|
||||
form_tag_in_block(html_options, &block)
|
||||
form_tag_with_body(html_options, capture(&block))
|
||||
else
|
||||
form_tag_html(html_options)
|
||||
end
|
||||
@ -848,8 +848,7 @@ def form_tag_html(html_options)
|
||||
tag(:form, html_options, true) + extra_tags
|
||||
end
|
||||
|
||||
def form_tag_in_block(html_options, &block)
|
||||
content = capture(&block)
|
||||
def form_tag_with_body(html_options, content)
|
||||
output = form_tag_html(html_options)
|
||||
output << content
|
||||
output.safe_concat("</form>")
|
||||
|
Loading…
Reference in New Issue
Block a user