aboutsummaryrefslogtreecommitdiffstats
path: root/lib/use_spans_for_errors.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/use_spans_for_errors.rb')
-rw-r--r--lib/use_spans_for_errors.rb12
1 files changed, 12 insertions, 0 deletions
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>)}
+