diff --git a/mogenerator.m b/mogenerator.m index b49ffedf..114ce5f4 100644 --- a/mogenerator.m +++ b/mogenerator.m @@ -186,9 +186,14 @@ - (NSString*)_resolveKeyPathType:(NSString*)keyPath { NSEntityDescription *entity = self; nsenumerate(components, NSString, key) { - NSRelationshipDescription *relationship = [[entity relationshipsByName] objectForKey:key]; - assert(relationship); - entity = [relationship destinationEntity]; + id property = [[entity propertiesByName] objectForKey:key]; + if ([property isKindOfClass:[NSAttributeDescription class]]) { + NSString *result = [property objectAttributeType]; + return [result substringToIndex:[result length] -1]; + } else if ([property isKindOfClass:[NSRelationshipDescription class]]) { + entity = [property destinationEntity]; + } + assert(property); } return [entity managedObjectClassName]; diff --git a/test/test.xcdatamodel/elements b/test/test.xcdatamodel/elements index 8f93d92d..91c6c42d 100644 Binary files a/test/test.xcdatamodel/elements and b/test/test.xcdatamodel/elements differ diff --git a/test/test.xcdatamodel/layout b/test/test.xcdatamodel/layout index b35edce2..68c15674 100644 Binary files a/test/test.xcdatamodel/layout and b/test/test.xcdatamodel/layout differ