Fix bug with mock generation for polymorphic models