Skip to content

Instantly share code, notes, and snippets.

@graudeejs
Created July 21, 2012 17:30
Show Gist options
  • Save graudeejs/3156501 to your computer and use it in GitHub Desktop.
Save graudeejs/3156501 to your computer and use it in GitHub Desktop.
field_error_proc
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