Created
December 5, 2012 19:18
-
-
Save aalvesjr/4218649 to your computer and use it in GitHub Desktop.
Otimizando mensagens de erros em CRUD'S Rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Arquivo shared/_error_messages.html.erb --> | |
<% unless record.errors.empty? %> | |
<dl class="error-messages"> | |
<dt>Não esta salvando essa porra porque:</dt> | |
<% record.errors.full_messages.each do |message| %> | |
<dd><%= message %></dd> | |
<% end %> | |
</dl> | |
<% end %> | |
<!-- Fim --> | |
<!-- Usaria essa chamada em todos os CRUDS --> | |
<%= form_for @question do |f| %> | |
<%= render "shared/error_messages", :record => @question %> | |
<!-- formulario com os campos --> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment