Skip to content

Instantly share code, notes, and snippets.

@nodunayo
Created December 25, 2013 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nodunayo/8119582 to your computer and use it in GitHub Desktop.
Save nodunayo/8119582 to your computer and use it in GitHub Desktop.
Rails error message notifications
#place immediately under 'form_for' line
<% if @item.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@item.errors.count, "error") %> prohibited this item from being saved:</h2>
<ul>
<% @item.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment