Resolved an issue with the Mongoid adapter + Mongoid 2.0 RC #15

wants to merge 4 commits into


None yet
3 participants

matt-royal commented Mar 23, 2011

I ran into a problem with Pickle when using Mongoid 2.0.0.rc.8 . Mongoid::Document::PickleAdapter.model_classes assumes that all descendants of Mongoid::Document will be a model, but Mongoid 2.0 creates an empty nameless class that includes Mongoid::Document inside Mongoid::Config#destructive_fields. This nameless instance causes a NilClass exception inside model_classes.

I didn't see any tests for Mongoid in your suite (please let me know if I missed them), so I did not include a new test for this situation. The change is small and innocuous, though, so a test may not be necessary.

Thanks for all of your great work on Pickle,
-Matt Royal

Matt Royal and others added some commits Mar 23, 2011

The Mongoid adapter ignores classes instances without a name
An anonymous class that includes Mongoid::Document is created in
Mongoid::Config#destructive_fields, which previously caused the Mongoid
adapter in Pickle to raise an exception in some cases

chewi commented Nov 21, 2014

Not sure if this is still necessary but seems harmless enough. Merged the first commit with a small adjustment.

@chewi chewi closed this Nov 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment