Make model_set handle collections that are relations and not arrays

This commit is contained in:
Luis Ramos
2020-05-19 19:06:14 +01:00
parent 65ce183830
commit cc1b4123b7

View File

@@ -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