Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

call `capture` fewer times from `form_for`

  • Loading branch information...
commit e2a97adbae6c90b1a749d28ed9aae1f83ec524e9 1 parent 8899503
@tenderlove tenderlove authored
View
3  actionview/lib/action_view/helpers/form_helper.rb
@@ -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:
View
5 actionview/lib/action_view/helpers/form_tag_helper.rb
@@ -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>")
Please sign in to comment.
Something went wrong with that request. Please try again.