Skip to content

Instantly share code, notes, and snippets.

@smonteverdi
Created June 25, 2012 16:23
Show Gist options
  • Save smonteverdi/2989563 to your computer and use it in GitHub Desktop.
Save smonteverdi/2989563 to your computer and use it in GitHub Desktop.
Rails: Partial: Display Form Errors
<% if object.errors.any? %>
<div id="error_explanation">
<h2>Oops, looks like <%= pluralize(object.errors.count, "error") %>
occured:</h2>
<br />
<ul>
<% object.errors.each do |key, msg| %>
<li><%=key%> <%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= render :partial => 'name_of_partial_to_show_model_errors', :locals => {:object => @model1} %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment