1
我爲this tutorial(以及其他)構建了我的Rails應用程序的認證系統。如何使用Rails應用程序中的用戶密碼驗證帳戶終止?
一切都會按計劃,但它仍然是太容易讓用戶摧毀他自己的帳戶(因此它包含的所有數據):
class UsersController < ApplicationController
def destroy
@user.destroy
flash[:success] = "Your account has been deleted."
redirect_to root_path
end
end
現在,我有這個在我edit
觀點:
<%= link_to "Delete own account", @user, :confirm => "Are you REALLY sure?", :method => :delete %>
什麼是Rails的方式送之前以及延長這一點,並要求用戶的密碼,他/她可以毀滅自己的帳戶?
感謝您的任何幫助。
好的,謝謝你指着我在正確的方向。我被卡住了,但是,並張貼[另一個問題](http://stackoverflow.com/questions/19492488/how-to-post-to-destroy-action-with-form-for-in-rails-app) 。 – Tintin81