当我按更新删除帐户时设计

时间:2015-09-14 13:59:31

标签: ruby-on-rails ruby devise

有时更新按钮有效,有时也不行。有时,如果按下更新按钮,则会删除用户的帐户。我不知道我的代码有什么问题。所有答案都非常感谢,谢谢。这是我的代码。

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

<%= form_for(resource, as: resource_name, url:     registration_path(resource_name), html: { method: :put }) do |f| %>
<%= devise_error_messages! %>
<div class="field">
<p><label>First Name:</label><br />
<%= f.text_field :first_name %></p>  
</div>

<div class="field">
<p><label>Username:</label><br />
<%= f.text_field :username %></p  
</div>

<div class="field">
<label>Email:</label><br />
<%= f.email_field :email %>
</div>

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

<div class="field">
<label>New Password:</label> <i>(leave blank if you don't want to change it)  </i><br />
<%= f.password_field :password, autocomplete: "off" %>
</div>

<div class="field">
<label>Password Confirmation:</label><br />
<%= f.password_field :password_confirmation, autocomplete: "off" %>
</div>

<div class="field">
<label>Current Password: <i>(we need your current password to confirm your changes)</i></label> <br />
<%= f.password_field :current_password, autocomplete: "off" %>
</div>

<div class="actions">
<%= f.submit "Update" %>
</div>
<% end %>

<h3>Cancel my account</h3>

<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure you want to  permanently delete your account?" }, method: :delete %></p> </div>

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

1 个答案:

答案 0 :(得分:0)

抱歉,发现了什么问题。我错过了

</p> 

标签