gpt4 book ai didi

ruby-on-rails - 如何确定 Rails 对象是否标记为_for_destruction?

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

我有一些对象恰好是其他东西的nested_attributes。
当它们被标记为删除时,Rails 会创建一个属性“marked_for_destruction”。
我如何阅读这个变量?

示例 Yaml 转储:

--- &id001 !ruby/object:LineItem 
attributes:
name:Pay
created_at: 2009-10-12 16:30:51
updated_at: 2009-10-12 16:30:51
statement_id: "8"
amount: "234"
id: "33"
attributes_cache: {}

errors: !ruby/object:ActiveRecord::Errors
base: *id001
errors: {}

marked_for_destruction: true

最佳答案

Object.marked_for_destruction?

关于ruby-on-rails - 如何确定 Rails 对象是否标记为_for_destruction?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1555625/

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