I'm having the weirdest bug I've ever seen: occasionally my models get mixed up.
I can't always reproduce the bug, it just happens randomly, and after a few refreshes/minutes it gets back to normal, but when it happens, for example, an instance of the User model get fed with data from policies collection.
There was even a case that an instance of Policy ended up with database connection information and in another one, an instance of User got a results attribute with the results of an aggregation I had just ran.
Unfortunately I was dumb enough to lose the sample, but it looked like this:
All user's real attributes were null.
I noticed something else; during one of the times I could reproduce it in development, a simple User.find would return DocumentNotFound, but the ID did existed.
I have no idea where to begin. I made no changes to the code and, other than that everything else seems fine.
Does anybody has any insight ?
It's a Rails 3.2 app, using Mongoid 3.1.6.
Thanks in advance.