我有我的用户和配置文件在不同的模型。当用户被删除时,链接的配置文件将保留,这是所需的结果。我想要做的是将配置文件记录标记为已删除。设计:如何自定义注册控制器销毁方法
我已经添加了一个删除列(布尔)到我的个人资料表,但无法弄清楚如何将设置添加到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
谢谢,我已经更新我的代码 –