Skip to content

Instantly share code, notes, and snippets.

@jasonlyles
Created February 15, 2012 17:00
Show Gist options
  • Save jasonlyles/1837324 to your computer and use it in GitHub Desktop.
Save jasonlyles/1837324 to your computer and use it in GitHub Desktop.
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
unless html_tag =~ /^<label/
%{<span class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message"> #{instance.error_message.first}</label></span>}.html_safe
else
#%{<span class="field_with_errors">#{html_tag}</span>}.html_safe
%{#{html_tag}}.html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment