2013-12-24 3 views
1

방금 ​​몽고 이드 3으로 업그레이드했지만 매우 이상한 문제가 있습니다.Model.first를 수행 할 때의 몽고 이드 오류

"Event"라는 모델과 "Team"이라는 모델이 있습니다. 각각 has_and_belongs_to_many 관계가 있습니다.

업그레이드 후 콘솔에서 Event.first 또는 Event.last를 단순히 수행 할 수 없습니다. 나는 콘솔에서이 오류를 얻을 :

undefined method `each' for nil:NilClass 

오류가 mongoid에 set_on_parent 발생 (4.0.0.alpha1) lib/mongoid/relations/eager/base.rb

은 무엇 이상한 것은 Team.first (내 모든 다른 모델)이 잘 작동한다는 것입니다 .

답변

1

내 이벤트 클래스에서 나는 default_scope includes(:teams)을 가지고 있습니다. 제거하면 오류가 해결됩니다.