1

I just upgraded to Mongoid 3, but I'm having a very strange issue.

I have a model called "Event" and another called "Team" - each has has_and_belongs_to_many relationship.

After upgrading, I simply can't do Event.first or Event.last on the console. I get this error in the console:

undefined method `each' for nil:NilClass

The error occurs in set_on_parent in mongoid (4.0.0.alpha1) lib/mongoid/relations/eager/base.rb

What's strange is that Team.first (and all my other models) work fine.

K2xL
  • 9,730
  • 18
  • 64
  • 101

1 Answers1

1

Turns out in my Event class I had a default_scope includes(:teams). Removing that cleared up the error.

Arun Kumar Mohan
  • 11,517
  • 3
  • 23
  • 44
K2xL
  • 9,730
  • 18
  • 64
  • 101