I'm using Rails nested attributes with allow_destroy: true
. If I call something like this:
deck.update(deck_items_attributes: { id: 1000, _destroy: true })
and the deck_item
with id 1000
does not exist Rails raise the exception ActiveRecord::RecordNotFound
.
Is there any way to tell Rails not to throw the exception and just ignore that record?
You can always use begin rescue to handle such type of exceptions like this