Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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
- end
- end
Add Comment
Please, Sign In to add comment