That probably means `course` is nil, which it should not be. Can you put a debugger in `Grade#cache_associations` and see why?