Rails Validation fieldWithErrors annoyance

So I’m thoroughly annoyed that a fieldWithErrors div wraps around a field that fails validation. I added a file called field_with_error_fix.rb in config/initializers to solve this pesky problem. It has the following code:

ActionView::Base.field_error_proc = Proc.new { |html_tag, instance|
"<span class=\"fieldWithErrors\">#{html_tag}</span>" }

Goodbye inappropriate divs!

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Mixx
  • Google Bookmarks
  • DZone
  • blogmarks
  • Bumpzee

Tags: , , , ,


You can skip to the end and leave a response. Pinging is currently not allowed.

  • Victor
    Awesome. Been looking for this solution for a while.
blog comments powered by Disqus