I am using Rails 3.2.2 with mongoid 2.4.6. In order to keep my collections small I am storing child objects to a base class in sepparate collections using the "store_in" statement. My code looks like this:
class BaseClass
include Mongoid::Document
end
class ChildClass1 < BaseClass
store_in :child_1
end
class ChildClass2 < BaseClass
store_in :child_2
end
It appears that the objects get randomly stored in or or the other child collection. An object of type Child1 sometimes gets stored in collection Child2. Here is the surprising thing that I see in my logs:
Started POST "/child_class_1" for 127.0.0.1 at 2012-05-22 10:22:51 -0400
Processing by ChildClass1Controller#create as HTML
MONGODB (0ms) myproject_development['child_2'].insert....
Where does that come from? Is this a bug in mongoid, rails or mongodb?