class Foo
include Mongoid::Document
end
class Bar < Foo
end
Foo.all returns Bars, and Bar.all returns Foos.
I want to put Foo and Bar in separate collections.
I tried
class Bar < Foo
store_in collection: 'bars'
but got
Mongoid::Errors::InvalidStorageParent:
Problem:
Invalid store_in call on class Bar.
Summary:
The :store_in macro can only be called on a base Mongoid Document
Using Mongoid 4.0.2
You need to make Bar
a Mongoid
document as well.
class Bar < Foo
include Mongoid::Document
store_in collection: 'bars'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With