Skip to content

Instantly share code, notes, and snippets.

@chadjemmett
Created October 20, 2013 01:35
Show Gist options
  • Save chadjemmett/7063810 to your computer and use it in GitHub Desktop.
Save chadjemmett/7063810 to your computer and use it in GitHub Desktop.
Shared error messages for ruby on rails. Replace @user with relevant variable. Also change the css classes and such to match the app you use it on.
<% if @user.errors.any? %>
<div id="error_explanation" >
<div class="alert alert-error">
The form contains <%= pluralize(@user.errors.count, "error") %>.
</div>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li>* <%= msg %></li></br>
<% end %>
</ul>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment