I get the following error:
NoMethodError (undefined method `eager_load' for nil:NilC开发者_开发问答lass)
when I run the following command in Mongoid 2.2.1
Person.includes(:game).all.each do
user.game.dosomething
end
a Person has_one Game
Just turn on Identity Map: http://mongoid.org/en/mongoid/docs/identity_map.html
Try add this to your Gemfile
# gem "mongoid-eager-loading"
But note that it's deprecated in newer mongoid versions
精彩评论