Obtain permanent IDs on inserted objects before saving #250

Merged
merged 1 commit into from Sep 7, 2012
View
2 MagicalRecord/Core/MagicalRecordNestedContextsPersistenceStrategy.m
@@ -17,6 +17,8 @@ - (void)setUpContextsWithCoordinator:(NSPersistentStoreCoordinator *)coordinator
NSManagedObjectContext *defaultContext = [NSManagedObjectContext MR_newMainQueueContext];
[defaultContext setParentContext:rootContext];
[NSManagedObjectContext MR_setDefaultContext:defaultContext];
+ [NSManagedObjectContext MR_makeContextObtainPermanentIDsBeforeSaving:defaultContext];
+ [NSManagedObjectContext MR_makeContextObtainPermanentIDsBeforeSaving:rootContext];
[NSManagedObjectContext MR_makeContext:rootContext mergeChangesToContext:defaultContext];
}
View
3 MagicalRecord/Core/MagicalRecordParallelStoresPersistenceStrategy.m
@@ -33,7 +33,8 @@ - (void)setUpContextsWithCoordinator:(NSPersistentStoreCoordinator *)coordinator
// Use the coordinator passed in
[defaultContext setPersistentStoreCoordinator:coordinator];
[NSManagedObjectContext MR_setDefaultContext:defaultContext];
-
+ [NSManagedObjectContext MR_makeContextObtainPermanentIDsBeforeSaving:defaultContext];
+ [NSManagedObjectContext MR_makeContextObtainPermanentIDsBeforeSaving:rootContext];
[NSManagedObjectContext MR_makeContext:rootContext mergeChangesToContext:defaultContext];
[NSManagedObjectContext MR_makeContext:defaultContext mergeChangesToContext:rootContext];
}