-
-
Save dustMason/5817510 to your computer and use it in GitHub Desktop.
Rails 3 ActionView override for Foundation 4 field error 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
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
html = %(<div class="error">#{html_tag}) | |
html += %(<small>#{instance.error_message.to_a.to_sentence}</small>).html_safe unless html_tag =~ /^<label/ | |
html += %(</div>) | |
html.html_safe | |
end |
This helped me out a bunch, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that this wraps labels and inputs in their own
<div>
's. This is fine for my project, YMMV