Reputation: 5721
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.
Upvotes: 12
Views: 2477
Reputation: 989
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.
Upvotes: 11