gpt4 book ai didi

ruby-on-rails - rails : Is there an equivalent to save_without_validation which skips after_save filters?

转载 作者:行者123 更新时间:2023-12-04 06:04:55 25 4
gpt4 key购买 nike

我有一个 after_save 过滤器,我不想在特定实例中触发它。有没有类似于 save_without_validation 的方法?

谢谢,

最佳答案

使用 rails 2 时,可以调用私有(private)方法 create_without_callbacks通过做:

@my_obj.send(:create_without_callbacks)

关于ruby-on-rails - rails : Is there an equivalent to save_without_validation which skips after_save filters?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/315724/

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