Ruby on Rails -- undo mark_for_destruction
Asked Answered
S

1

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.

Smashup answered 22/2, 2011 at 15:58 Comment(0)
M
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.

Megargee answered 9/8, 2011 at 23:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.