Created
July 21, 2012 17:30
-
-
Save graudeejs/3156501 to your computer and use it in GitHub Desktop.
field_error_proc
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| | |
unless html_tag =~ /^<label/ | |
unless html_tag =~ / type=(["'])(radio|chekbox)\1/ | |
%{<div class="field_with_errors">#{html_tag}<div class="error">#{instance.error_message.first}</div></div>}.html_safe | |
end | |
else | |
html_tag | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment