Skip to content

Instantly share code, notes, and snippets.

@andrewtheis
Created December 28, 2010 21:22
Show Gist options
  • Save andrewtheis/757736 to your computer and use it in GitHub Desktop.
Save andrewtheis/757736 to your computer and use it in GitHub Desktop.
<%= form_for @account do |f| %>
<%= render "shared/form_errors", :object => @account %>
# ... Other form view code here ...</span>
<% if object.errors.any? %>
<div id="error_explanation">
<h2>Please fix the following <%= pluralize(object.errors.count, "error") %>:</h2>
<ul>
<% object.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<% if @model.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@session.errors.count, "error") %> with form:</h2>
<ul>
<% @session.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