From cc1b4123b7a6b8ce5c41d4bb0bcc55480c8a25d8 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Tue, 19 May 2020 19:06:14 +0100 Subject: [PATCH] Make model_set handle collections that are relations and not arrays --- app/models/model_set.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/model_set.rb b/app/models/model_set.rb index 1d5d7dbda3..8a599b4214 100644 --- a/app/models/model_set.rb +++ b/app/models/model_set.rb @@ -50,6 +50,7 @@ class ModelSet # Remove all elements to be deleted from collection and return them # Allows us to render @model_set.collection without deleted elements deleted = [] + @collection = collection.to_a collection.delete_if { |e| deleted << e if @delete_if.andand.call(e.attributes) } deleted end