Infer class for polymorphic associations