aboutsummaryrefslogtreecommitdiffstats
path: root/lib/use_spans_for_errors.rb
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2009-12-03 12:38:52 +0000
committerFrancis Irving <francis@mysociety.org>2009-12-03 12:38:52 +0000
commita782cbf5752c5e528ffd733e688ac2ce34dcce6a (patch)
tree5d4510c29df84afed176210a90f0f3ad176e2584 /lib/use_spans_for_errors.rb
parente639fa544efc96c7707f43d382e09cb2aae9e28d (diff)
Move span/div fix into its own lib file
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>)}
+