mongoid/mongoid — Issue #1411: rails-dev-boost incompatiblity
Author: thedarkone
Created: 2011-11-05 15:12:49+00:00
State: open

Hey guys,

sorry, if the issue tracker isn't the best place for this.

I'm the maintainer of the [rails-dev-boost](https://github.com/thedarkone/rails-dev-boost) (a Rails plugin that speeds up development mode by reloading only the changed ruby files in between requests). I have users reporting incompatibility with `mongoid` here: thedarkone/rails-dev-boost#27.

Basically the only thing that should be able to trip `rails-dev-boost` up are "class-level" references between reloadable constants, the plugin already ships with custom `ActiveRecord`-handling code: [see here](https://github.com/thedarkone/rails-dev-boost/blob/dd82d6caf24e607f8a7f2359e46796c7f8683e50/lib/rails_development_boost/dependencies_patch.rb#L316-330).

I went over `mongoid`'s codebase looking for class-level caching behaviour and only found 3 things:

* `Mongoid::Relations::Metadata`'s [`@klass`](https://github.com/mongoid/mongoid/blob/aea719c8d0f72396469015fe4520c4ed103dd4d1/lib/mongoid/relations/metadata.rb#L535) and [`@inverse_klass`](https://github.com/mongoid/mongoid/blob/aea719c8d0f72396469015fe4520c4ed103dd4d1/lib/mongoid/relations/metadata.rb#L430) instance vars,
* `Mongoid::Document::ClassMethods`'s [`@_types`](https://github.com/mongoid/mongoid/blob/aea719c8d0f72396469015fe4520c4ed103dd4d1/lib/mongoid/document.rb#L257) cache.

Here's my current `mongoid`-specific patch: [see code here](https://github.com/thedarkone/rails-dev-boost/blob/c9692f69ba04270fd539b01bb8ca97dc6a468fc2/lib/rails_development_boost/dependencies_patch.rb#L336-355).

Users are reporting that this is not enough, this means I must have missed something. Can any of the `mongoid`'s devs help me out?

Thanks!