I am working on my making a sample app from Rails Tutorial by Micheal Hartl. I was working on the errors on my sign up page and I came across an issue im not able to solve.
Here after the 5 listed error messages theres an unwanted array listing the same error messages.
Here's the HTML
<%= provide(:title, 'Sign up') %>
<h1>Sign Up</h1>
<div class = "row">
<div class = "col-md-6 col-md-offset-3">
<%= form_for(@user) do |f| %>
<%= render 'shared/error_messages' %>
<%= f.label :name %>
<%= f.text_field :name, class: 'form-control' %>
<%= f.label :email %>
<%= f.text_field :email, class: 'form-control' %>
<%= f.label :password %>
<%= f.password_field :password, class: 'form-control' %>
<%= f.label :password_confirmation, "Confirmation"%>
<%= f.password_field :password_confirmation, class: 'form-control' %>
<%= f.submit "Create My Account", class: "btn btn-primary" %>
<% end %>
</div>
And here's the error message partial:
<% if @user.errors.any? %>
<div id="error_explaination">
<div class="alert alert-danger">
The form contains <%= pluralize(@user.errors.count, "error")%>
</div>
<ul>
<%= @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
And SCSS file:
/* FORMS */
input, textarea, select, .uneditable-input{
border: 1px solid #bbb;
width: 100%;
margin-bottom: 15px;
@include box_sizing;
}
input{
height: auto !important;
}
#error_explaination{
color: red;
ul{
color: red;
margin: 0 0 30px 0;
}
}
.field_with_errors{
@extend .has-error;
.form-control{
color: $state-danger-text;
}
}
Help me out. Thanks
Aucun commentaire:
Enregistrer un commentaire