-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
I have model base class that other models extend. I use this base class to store generic data. This results in one collection storing all objects from all these classes.
When I try to run: {{BaseModel.all.group_by
{ |obj| obj._type }.keys}}
I get exception on base class objects missing _type property. This is not true, since these objects have this property in the database. For some reason base class doesn't promote the _type property.
`NoMethodError: undefined method _type for #<BaseModel:0x007fb9668da640>
from (irb):1:in block in irb_binding
from /Users/napalm/.rvm/gems/ruby-2.0.0-p247/bundler/gems/mongoid-88599cf64c3d/lib/mongoid/contextual/mongo.rb:671:in yield_document
from /Users/napalm/.rvm/gems/ruby-2.0.0-p247/bundler/gems/mongoid-88599cf64c3d/lib/mongoid/contextual/mongo.rb:124:in block (2 levels) in each`