Created
October 9, 2012 20:54
-
-
Save msroot/3861361 to your computer and use it in GitHub Desktop.
rails errors
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
| <% if @entry.errors.include?(:state) %> | |
| <div class="control-group"> | |
| <div class="controls"> | |
| <div class="error"> <%= @entry.errors["state"][0] %></div> | |
| </div> | |
| </div> | |
| <% end %> | |
| ###############OR | |
| #in application rb | |
| Include the errors in the html fields | |
| ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
| "<div class=\"field_with_errors\"> | |
| #{html_tag} | |
| <div class=\"error\">#{instance.error_message.first}</div> | |
| </div>".html_safe | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment