From 5771a92fa4345c6284e931e976a011bfa73e9f10 Mon Sep 17 00:00:00 2001 From: Alex MacCaw Date: Wed, 24 Dec 2008 09:25:07 +0000 Subject: [PATCH] ActiveRecordHelper shouldn't generate form items in a div (with a class of fieldWithErrors) since a lot of the time these form elements are in a 'p' element (even the Rails scaffolding generates it so) and, since you can't have a block element in an inline one, the page breaks in many browsers (it's standards uncompliant). This fixes just changes it to a span element. --- .../action_view/helpers/active_record_helper.rb | 2 +- .../test/template/active_record_helper_test.rb | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/actionpack/lib/action_view/helpers/active_record_helper.rb b/actionpack/lib/action_view/helpers/active_record_helper.rb index 8b56d24..75665df 100644 --- a/actionpack/lib/action_view/helpers/active_record_helper.rb +++ b/actionpack/lib/action_view/helpers/active_record_helper.rb @@ -3,7 +3,7 @@ require 'action_view/helpers/form_helper' module ActionView class Base - @@field_error_proc = Proc.new{ |html_tag, instance| "
#{html_tag}
" } + @@field_error_proc = Proc.new{ |html_tag, instance| "#{html_tag}" } cattr_accessor :field_error_proc end diff --git a/actionpack/test/template/active_record_helper_test.rb b/actionpack/test/template/active_record_helper_test.rb index e46f95d..261f2ff 100644 --- a/actionpack/test/template/active_record_helper_test.rb +++ b/actionpack/test/template/active_record_helper_test.rb @@ -109,21 +109,21 @@ class ActiveRecordHelperTest < ActionView::TestCase def test_text_area_with_errors assert_dom_equal( - %(
), + %(), text_area("post", "body") ) end def test_text_field_with_errors assert_dom_equal( - %(
), + %(), text_field("post", "author_name") ) end def test_form_with_string assert_dom_equal( - %(


\n


), + %(


\n


), form("post") ) @@ -136,7 +136,7 @@ class ActiveRecordHelperTest < ActionView::TestCase end assert_dom_equal( - %(


\n


), + %(


\n


), form("post") ) end @@ -146,14 +146,14 @@ class ActiveRecordHelperTest < ActionView::TestCase @request_forgery_protection_token = 'authenticity_token' @form_authenticity_token = '123' assert_dom_equal( - %(


\n


), + %(


\n


), form("post") ) end def test_form_with_method_option assert_dom_equal( - %(


\n


), + %(


\n


), form("post", :method=>'get') ) end @@ -261,7 +261,7 @@ class ActiveRecordHelperTest < ActionView::TestCase def test_form_with_string_multipart assert_dom_equal( - %(


\n


), + %(


\n


), form("post", :multipart => true) ) end -- 1.5.6.1 From 5de64672494ee0d89c641923dae8365a811baaf9 Mon Sep 17 00:00:00 2001 From: Alex MacCaw Date: Wed, 24 Dec 2008 09:34:56 +0000 Subject: [PATCH] Update docs that refer to a div with a class of fieldWithErrors rather than a span --- railties/doc/guides/source/configuring.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/railties/doc/guides/source/configuring.txt b/railties/doc/guides/source/configuring.txt index 945e48c..c9978d3 100644 --- a/railties/doc/guides/source/configuring.txt +++ b/railties/doc/guides/source/configuring.txt @@ -107,7 +107,7 @@ There are only a few configuration options for Action View, starting with four o +warn_cache_misses+ tells Rails to display a warning whenever an action results in a cache miss on your view paths. The default is +false+. -+field_error_proc+ provides an HTML generator for displaying errors that come from Active Record. The default is +Proc.new{ |html_tag, instance| "
#{html_tag}
" }+ ++field_error_proc+ provides an HTML generator for displaying errors that come from Active Record. The default is +Proc.new{ |html_tag, instance| "#{html_tag}" }+ +default_form_builder+ tells Rails which form builder to use by default. The default is +ActionView::Helpers::FormBuilder+. -- 1.5.6.1