Closed tomfakes closed 11 years ago
This is a little more dangerous than just that too. If the collection is a has_many collection, I think it may have been possible to actually destroy activerecord objects accidentally. Since Rails aliases the .delete() method which I'm using here on the "collection". I believe cloning the collection should take care of that and the issue you brought up above.
Depending on how many fragments are cached, items are removed from the collection. This leaves the collection with fewer than the items it started with, sometimes as little as zero items.
It would be nice if the collection was not destroyed during the process, so it can be used again, or used for other reasons.