Permalink
Browse files

Mostra mensagens de erro

  • Loading branch information...
elomar committed Mar 10, 2012
1 parent e887e35 commit d5cd096cac3de5f6e19e391f09e95e344d04d492
Showing with 13 additions and 0 deletions.
  1. +12 −0 app/views/shared/_error_messages.html.erb
  2. +1 −0 app/views/usuarios/new.html.erb
@@ -0,0 +1,12 @@
+<% if @usuario.errors.any? %>
+ <div id="error_explanation">
+ <div class="alert alert-error">
+ O formuário contém <%= pluralize(@usuario.errors.count, "erro") %>:
+ </div>
+ <ul>
+ <% @usuario.errors.full_messages.each do |msg| %>
+ <li><%= msg %></li>
+ <% end %>
+ </ul>
+ </div>
+<% end %>
@@ -2,6 +2,7 @@
<h1>Cadastre-se</h1>
<%= form_for(@usuario) do |f| %>
+ <%= render 'shared/error_messages' %>
<p>
<%= f.label :nome %>

0 comments on commit d5cd096

Please sign in to comment.