3

I am using devise and simple form with rails. I can't figure out why a field with errors div or any div for that matter is not being created when there is a failed validation. I have tried deleting everything after f.input :first_name and still no new divs. Let me know what other info you might need to help me figure out my problem.

<% provide(:title, 'Sign up') %>
<h1>Sign up</h1>

<div id="sign-up" class="row">
  <div class="col-md-6 col-md-offset-3">
    <%= render 'shared/error_messages' %>
    <%= simple_form_for(resource, :as => resource_name, 
                        :url => registration_path(resource_name), 
                        html: {class: "well"}) do |f| %>

      <ul class="inline-layout">
        <li>
            <%= f.input :first_name, required: false,
                          placeholder: 'First name',
                          label: false,
                          error: false,
                          input_html: {class: 'form-control inherit-width'} %>
        </li>

Here is the error_messages partial:

<% if @user.errors.any? %>
  <div id="error_explanation">
    <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 %>

Edit:

Looks like I am getting a new div class 'error' but I want it to be 'field_with_errors' I tried changing all instances of 'error' in the simple_form.rb file but it didn't change anything. I'll just have to change my css.

user4584963
  • 2,403
  • 7
  • 30
  • 62

0 Answers0