我有我的用戶和配置文件在不同的模型。當用戶被刪除時,鏈接的配置文件將保留,這是所需的結果。我想要做的是將配置文件記錄標記爲已刪除。設計:如何自定義註冊控制器銷燬方法
我已經添加了一個刪除列(布爾)到我的個人資料表,但無法弄清楚如何將設置添加到true設置爲設計銷燬方法?
應用程序\控制器\ registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
def destroy
delete_profile(params)
end
private
def delete_profile(params)
profile = Profile.find(params[:id])
profile.deleted = true
end
end
,但我能弄清楚如何去解決這個錯誤
Couldn't find Profile without an ID
我怎麼能在正確的PARAMS通過從用戶刪除我的看法?
你有'destroy'方法名錯字 – NARKOZ
謝謝,我已經更新我的代碼 –