aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/environment.rb4
-rw-r--r--lib/use_spans_for_errors.rb12
2 files changed, 13 insertions, 3 deletions
diff --git a/config/environment.rb b/config/environment.rb
index 70e7c8f14..c62fffa4a 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -79,9 +79,6 @@ end
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "application/x-mobile", :mobile
-# Monkeypatch! Use SPAN instead of DIV. See http://dev.rubyonrails.org/ticket/2210
-ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| %(<span class="fieldWithErrors">#{html_tag}</span>)}
-
# Include your application configuration below
ActionController::Base.cache_store = :file_store, File.join(File.dirname(__FILE__), '../cache')
@@ -133,6 +130,7 @@ require 'activesupport_cache_extensions.rb'
require 'public_body_categories.rb'
require 'timezone_fixes.rb'
require 'fcgi_fixes.rb'
+require 'use_spans_for_errors.rb'
# XXX temp debug for SQL logging production sites
#ActiveRecord::Base.logger = Logger.new(STDOUT)
diff --git a/lib/use_spans_for_errors.rb b/lib/use_spans_for_errors.rb
new file mode 100644
index 000000000..cda05c588
--- /dev/null
+++ b/lib/use_spans_for_errors.rb
@@ -0,0 +1,12 @@
+# Monkeypatch! Use SPAN instead of DIV.
+#
+# Rails core refuse to fix this properly, by making it an official option.
+# Without it, you will get HTML validation errors in various places where an
+# error appears within a P.
+#
+# A monkeypatch will have to do.
+#
+# See http://dev.rubyonrails.org/ticket/2210
+
+ActionView::Base.field_error_proc = Proc.new{ |html_tag, instance| %(<span class="fieldWithErrors">#{html_tag}</span>)}
+