开发者

Ruby on Rails -- undo mark_for_destruction

开发者 https://www.devze.com 2023-02-12 21:45 出处:网络
开发者_运维技巧In my rails app the child records get marked_for_destruction I want to undo that action and unmark them. Is there a way?

开发者_运维技巧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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号