Skip to content

Instantly share code, notes, and snippets.

@zporter
Created November 9, 2011 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zporter/1351829 to your computer and use it in GitHub Desktop.
Save zporter/1351829 to your computer and use it in GitHub Desktop.
customize the Rails error messages that wrap around form fields
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
if html_tag =~ /<label[^>]+/
"<div class='field_with_errors'>#{html_tag}".html_safe
else
"#{html_tag}</div>".html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment