12

In my rails app the child records get marked_for_destruction I want to undo that action and unmark them. Is there a way?

Thanks in advance.

Rohit
  • 5,631
  • 4
  • 31
  • 59

1 Answers1

11

child.reload if child.marked_for_destruction?

From ActiveRecord::AutosaveAssociation:

reload(options = nil)

Reloads the attributes of the object as usual and clears marked_for_destruction flag.

Andrew Ashbacher
  • 989
  • 10
  • 19