I have Comment model:
class Comment
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :commentable, polymorphic: true, touch: true#, counter_cache: true
When I run:
Article.first.comments.count => 1 #without counter_cache: true
but with "counter_cache: true" I get :
Article.first.comments.count => NoMethodError: undefined method
count' for nil:NilClass Article.first.comments => NoMethodError: undefined method
count' for nil:NilClass
Has anyone encountered such problem?