When working with association collections like the ones created using has_many, you might want to treat it as a regular Array, unlinked to any database actions. Because of all the overriding going on, it is in fact even difficult to tell that a collection is not an array, but if you remove an item from a collection, it will update foreign keys and even delete records from the foreign table if the association is :dependent.
I’ve found that if you call collection.clone, it will create a copy of the collection that is an actual array that you can modify at will without database modifications. collection.to_a is not sufficient.
Is there a better way to copy a collection?