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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With