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
#Overrides the default way how rails marks form fields with errors. | |
#In this version, it only adds the class 'error' to label and element | |
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
if html_tag =~ /<(input|label|textarea|select)/ | |
html_field = Nokogiri::HTML::DocumentFragment.parse(html_tag) | |
html_field.children.add_class 'error' | |
html_field.to_s | |
else | |
html_tag |