diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-06-02 16:43:47 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-06-02 16:43:47 -0700 |
commit | e2a97adbae6c90b1a749d28ed9aae1f83ec524e9 (patch) | |
tree | e97a940b72a2b15a93fa2c366faae2734e051263 /actionview | |
parent | 8899503f62a556a918c45b3e7b5c2effaaa943f4 (diff) | |
download | rails-e2a97adbae6c90b1a749d28ed9aae1f83ec524e9.tar.gz rails-e2a97adbae6c90b1a749d28ed9aae1f83ec524e9.tar.bz2 rails-e2a97adbae6c90b1a749d28ed9aae1f83ec524e9.zip |
call `capture` fewer times from `form_for`
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/helpers/form_helper.rb | 3 | ||||
-rw-r--r-- | actionview/lib/action_view/helpers/form_tag_helper.rb | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/actionview/lib/action_view/helpers/form_helper.rb b/actionview/lib/action_view/helpers/form_helper.rb index 180c4a62bf..789a413c8d 100644 --- a/actionview/lib/action_view/helpers/form_helper.rb +++ b/actionview/lib/action_view/helpers/form_helper.rb @@ -434,7 +434,8 @@ module ActionView 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: diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 1e818083cc..f12d436f8e 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -67,7 +67,7 @@ module ActionView 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 @@ module ActionView 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>") |