Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if a Rails object is marked_for_destruction?

I have some objects which happen to be nested_attributes of something else. When they are marked to be deleted, Rails creates a property "marked_for_destruction". How do I read this var?

Sample Yaml dump:

--- &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
like image 687
Neil Middleton Avatar asked Dec 14 '22 02:12

Neil Middleton


1 Answers

object.marked_for_destruction?
like image 138
Neil Middleton Avatar answered Mar 04 '23 15:03

Neil Middleton