Created
October 22, 2012 23:03
-
-
Save allaire/3935307 to your computer and use it in GitHub Desktop.
Field with errors
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/ | |
%{<div class="field-with-errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label> </div>}.html_safe | |
else | |
%{<div class="field-with-errors">#{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