From 817fbf033b57dc6817e9edc727eb19d914a8c3df Mon Sep 17 00:00:00 2001 From: David Genord II Date: Fri, 18 Jun 2010 15:40:20 -0400 Subject: [PATCH] form_for without :html and with :remote should not error --- actionpack/lib/action_view/helpers/form_helper.rb | 2 +- actionpack/test/template/form_helper_test.rb | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index b3db315..a49daab 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -302,7 +302,7 @@ module ActionView args.unshift object end - options[:html][:remote] = true if options.delete(:remote) + (options[:html] ||= {})[:remote] = true if options.delete(:remote) output = form_tag(options.delete(:url) || {}, options.delete(:html) || {}) output << fields_for(object_name, *(args << options), &proc) diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 2f38699..8de1e78 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -644,6 +644,26 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end + def test_form_for_with_remote_without_html + assert_deprecated do + form_for(:post, @post, :remote => true) do |f| + concat f.text_field(:title) + concat f.text_area(:body) + concat f.check_box(:secret) + end + end + + expected = + "
" + + "" + + "" + + "" + + "" + + "
" + + assert_dom_equal expected, output_buffer + end + def test_form_for_without_object form_for(:post, :html => { :id => 'create-post' }) do |f| concat f.text_field(:title) -- 1.7.1