【问题标题】:Devise form rendered twice设计表单呈现两次
【发布时间】:2016-10-12 08:26:45
【问题描述】:

我遵循设计教程。我编辑了与教程所说的相同的表单,我看到它呈现了两次。

https://www.sitepoint.com/devise-authentication-in-depth/

我无法回复。

<% header "Sign Up" %>

<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
  <%= devise_error_messages! %>

  <div class="form-group">
    <%= f.label :name %>
    <%= f.text_field :name, class: 'form-control' %>
  </div>

  <div class="form-group">
    <%= f.label :email %>
    <%= f.email_field :email, class: 'form-control' %>
  </div>

  <div class="form-group">
    <%= f.label :password %>
    <%= f.password_field :password, autocomplete: "off", class: 'form-control' %>
    <% if @validatable %>
      <span class="help-block"><%= @minimum_password_length %> characters minimum</span>
    <% end %>
  </div>

  <div class="form-group">
    <%= f.label :password_confirmation %>
    <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control' %>
  </div>

  <%= f.submit "Sign up", class: 'btn btn-primary' %>
<% end %>

<%= render "devise/shared/links" %>

这是我的看法。我没有弄乱控制器。

【问题讨论】:

  • 最好在不离开SO的情况下在这里调试代码。那么您可以在此处发布与该问题相关的一些代码吗?喜欢特定的控制器和视图。
  • 现已编辑。对不起。
  • 不用道歉,很多人都会遇到这种情况。
  • 我怀疑这个问题与turbolinks 有关,如果你有,请尝试从application.js 中删除//= require turbolinks

标签: ruby-on-rails devise


【解决方案1】:

我认为我的模板有问题。已经解决了。

【讨论】:

    猜你喜欢
    • 2019-10-13
    • 1970-01-01
    • 2017-04-30
    • 2012-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-12
    • 2012-07-10
    相关资源
    最近更新 更多