rails/rails — pull request #9705 by macksmind (2013-03-13 18:44:16+00:00)
Title: Prevent mutation of unsaved AR collections by Marshal#dump

Marshal#dump calls CollectionProxy#respond_to? when dumping some AR
collections. The call to load_target may mutate the internal state
mid-dump, resulting in undesirable queries and a dumped string that may
not result in a usable object when processed by Marshal#load.

The proposed fix forces the use of Marshal internals to dump the
collection.