Created
November 9, 2011 15:42
-
-
Save zporter/1351829 to your computer and use it in GitHub Desktop.
customize the Rails error messages that wrap around form fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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