In Rails, I have the following Active Record Collection:
@products = Product.all
I need to loop through this collection and remove some objects from it without removing them from the database. Therefore, using
@products.each do |product|
if CONDITION
product.delete
end
end
Won't work, as this will also delete the product from the database. Is there a way to remove specific products from this collection without also deleting them from the database?