Last active
August 29, 2015 14:15
-
-
Save MartinHeimbring/fff9b6da83dff1b9b29f to your computer and use it in GitHub Desktop.
Form error messages w/ bootstrap (from MIchael Hartl Tutorial)
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
| <!-- _error_messages.html.erb --> | |
| <% if @user.errors.any? %> | |
| <div id="error_explanation"> | |
| <div class="alert alert-danger"> | |
| The form contains <%= pluralize(@user.errors.count, "error") %>. | |
| </div> | |
| <ul> | |
| <% @user.errors.full_messages.each do |msg| %> | |
| <li><%= msg %></li> | |
| <% end %> | |
| </ul> | |
| </div> | |
| <% end %> | |
| <!-- in _form.html.erb --> | |
| <%= render 'layout/errors', object: @model_object %> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment