Kaido
Kaido

Reputation: 127

Syntax error in devise edit.html.erb view

Basically when i'm logged, i try to navigate to http://localhost:3000/users/edit just to check if i get the form to edit the user informations but i get this error:

app/views/devise/registrations/edit.html.erb:16: syntax error, unexpected ':', expecting ')' input_html: { autocomplete: "new-password ^

    <h2>Edit <%= resource_name.to_s.humanize %></h2>

<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
  <%= f.error_notification %>

  <div class="form-inputs">
    <%= f.input :email, required: true, autofocus: true %>

    <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
      <p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
    <% end %>

    <%= f.input :password,
                hint: "leave it blank if you don't want to change it",
                required: false
                input_html: { autocomplete: "new-password" } %>
    <%= f.input :password_confirmation,
                required: false,
                input_html: { autocomplete: "new-password" } %>
    <%= f.input :current_password,
                hint: "we need your current password to confirm your changes",
                required: true,
                input_html: { autocomplete: "current-password" } %>
  </div>

  <div class="form-actions">
    <%= f.button :submit, "Update" %>
  </div>
<% end %>

<h3>Cancel my account</h3>

<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>

<%= link_to "Back", :back %>

I didn't modified any view and i didn't generate any user controller I`m using devise (4.5.0) and Rails 5.2.1 and Ruby ruby 2.4.4p296

Thanks for the help

Upvotes: 1

Views: 446

Answers (2)

Rockwell Rice
Rockwell Rice

Reputation: 3002

You are missing a comma, change the password section to what I have below

<%= f.input :password,
      hint: "leave it blank if you don't want to change it",
      required: false, <= this comma
      input_html: { autocomplete: "new-password" } %>

Upvotes: 2

Kaido
Kaido

Reputation: 127

You can close it i found the error. A missing , at the required: false line. It didn't work from the start, since when i generated the devise views, maybe a bug with my rails.

Upvotes: 1

Related Questions