-
-
Save gbalbuena/9023171 to your computer and use it in GitHub Desktop.
Rails Error field template bootstrap 3
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
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 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
# ... | |
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
html = %(<div class="error">#{html_tag}) | |
html += %( <small style='color: red;'>#{instance.error_message.to_a.to_sentence}</small>).html_safe unless html_tag =~ /^<label/ | |
html += %(</div>) | |
html.html_safe | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment