Created
September 13, 2011 12:47
-
-
Save kenzie/1213729 to your computer and use it in GitHub Desktop.
Rails 3 form error partial
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
<% if target.errors.any? %> | |
<div class="error_explanation"> | |
<h2><%= pluralize(target.errors.count, "error") %> prevented this record from being saved:</h2> | |
<ul> | |
<% target.errors.full_messages.each do |msg| %> | |
<li><%= msg %></li> | |
<% end %> | |
</ul> | |
</div> | |
<% end %> |
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
<%= form_for @user, :url => user_path do |f| %> | |
<%= render "shared/error_messages", :target => @user %> | |
<p> | |
<%= f.label :email %> | |
<%= f.text_field :email %> | |
</p> | |
<p> | |
<%= f.label :password %> | |
<%= f.password_field :password %> | |
</p> | |
<p class="actions"><%= f.submit %></p> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awesome