Skip to content

Instantly share code, notes, and snippets.

@joshmcarthur
Created May 10, 2012 02:38
Show Gist options
  • Save joshmcarthur/2650644 to your computer and use it in GitHub Desktop.
Save joshmcarthur/2650644 to your computer and use it in GitHub Desktop.
Render Rails form errors with Twitter Bootstrap styles
# config/initializers/form_errors.rb
#
# Wraps a <div> tag around the field with an error with the
# correct classes for Twitter bootstrap to style the inputs
# with errors correctly (red border/red box-shadow)
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance_tag|
"<div class='control-group error'>#{html_tag}</div>".html_safe
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment