moved form errors to partial

This commit is contained in:
Mark Moser
2016-08-19 16:42:06 -05:00
parent 77684b2c3e
commit 8209a2293b
8 changed files with 21 additions and 51 deletions

View File

@ -1,17 +1,7 @@
<main class="intro_tpl">
<h1>New Candidate</h1>
<% if flash[:error].present? %>
<div class="error">
<%= flash[:error] %>
<p>
<% @candidate.errors.messages.each do |k,v| %>
<%= "#{k.to_s} #{v.join(' and ')}" %><br />
<% end %>
</p>
</div>
<% end %>
<%= render partial: 'shared/form_model_errors', locals: { obj: @candidate } %>
<%= form_for @candidate, url: create_candidate_path do |form| %>
<div class="form-group">
<%= form.label :name, "Candidate name" %>