Created
May 10, 2012 02:38
-
-
Save joshmcarthur/2650644 to your computer and use it in GitHub Desktop.
Render Rails form errors with Twitter Bootstrap styles
This file contains hidden or 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
# 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