gpt4 book ai didi

ruby-on-rails - rails 3 before_update 回调

转载 作者:太空宇宙 更新时间:2023-11-03 17:59:20 24 4
gpt4 key购买 nike

我有一个带有 before_update 回调的模型

def
if !condition
#not update record
end
end

我需要这个不更新的东西,如何防止模型更新?

最佳答案

使用 custom validator .您不能阻止从 before_update 更新记录

关于ruby-on-rails - rails 3 before_update 回调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7731023/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com