gpt4 book ai didi

ruby-on-rails - 设计 edit.html.erb View 中的语法错误

转载 作者:太空宇宙 更新时间:2023-11-03 18:04:17 27 4
gpt4 key购买 nike

基本上,当我登录时,我会尝试导航到 http://localhost:3000/users/edit只是为了检查我是否获得了编辑用户信息的表单,但我收到了这个错误:

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 %>

我没有修改任何 View ,也没有生成任何用户 Controller 我正在使用 devise (4.5.0) 和 Rails 5.2.1 以及 Ruby ruby​​ 2.4.4p296

感谢帮助

最佳答案

您缺少一个逗号,请将密码部分更改为我下面的内容

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

关于ruby-on-rails - 设计 edit.html.erb View 中的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52248822/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com