diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-01-05 12:21:34 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-01-06 10:54:21 -0200 |
commit | 115a37d9c1b2d8868a188a23528e3397f6761971 (patch) | |
tree | 32db7cec7ae538569fba963351de60444f4753bb /actionpack/lib | |
parent | 94ecbb7e7bb70e56137df2e275e564fa4b5bc6fb (diff) | |
download | rails-115a37d9c1b2d8868a188a23528e3397f6761971.tar.gz rails-115a37d9c1b2d8868a188a23528e3397f6761971.tar.bz2 rails-115a37d9c1b2d8868a188a23528e3397f6761971.zip |
Do not call fields_for from form_for, to avoid instantiating two builders
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 50d3abd2fb..28ff75fdbe 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -388,9 +388,9 @@ module ActionView # In many cases you will want to wrap the above in another helper, so you # could do something like the following: # - # def labelled_form_for(record_or_name_or_array, *args, &proc) + # def labelled_form_for(record_or_name_or_array, *args, &block) # options = args.extract_options! - # form_for(record_or_name_or_array, *(args << options.merge(builder: LabellingFormBuilder)), &proc) + # form_for(record_or_name_or_array, *(args << options.merge(builder: LabellingFormBuilder)), &block) # end # # If you don't need to attach a form to a model instance, then check out @@ -412,7 +412,7 @@ module ActionView # <%= form_for @invoice, url: external_url, authenticity_token: false do |f| # ... # <% end %> - def form_for(record, options = {}, &proc) + def form_for(record, options = {}, &block) raise ArgumentError, "Missing block" unless block_given? options[:html] ||= {} @@ -434,9 +434,9 @@ module ActionView options[:html][:authenticity_token] = options.delete(:authenticity_token) builder = options[:parent_builder] = instantiate_builder(object_name, object, options) - fields_for = fields_for(object_name, object, options, &proc) + output = capture(builder, &block) default_options = builder.form_tag_attributes - form_tag(options[:url] || {}, default_options) { fields_for } + form_tag(options[:url] || {}, default_options) { output } end def apply_form_for_options!(record, object, options) #:nodoc: |