Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

saveWithBlock was not saving parent contexts

This makes the saveWithBlock method consistent with it's background
siblings.
  • Loading branch information...
commit 870ca22340946c6d8ab3410845320c786c769954 1 parent 835b467
@tonyarnold tonyarnold authored blackgold9 committed
View
12 MagicalRecord/Categories/NSManagedObjectContext/NSManagedObjectContext+MagicalSaves.m
@@ -95,13 +95,13 @@ - (void) MR_saveErrorHandler:(void (^)(NSError *))errorCallback;
{
[self performBlockAndWait:^{
[self MR_saveWithErrorCallback:errorCallback];
+
+ if (self.parentContext) {
+ [[self parentContext] performBlockAndWait:^{
+ [[self parentContext] MR_saveErrorHandler:errorCallback];
+ }];
+ }
}];
-
- if (self == [[self class] MR_defaultContext])
- {
- // Since this is a synchronous call, I made the background context save synchronous as well to reflect the intent.
- [[[self class] MR_rootSavingContext] MR_saveErrorHandler:errorCallback];
- }
}
- (void) MR_saveInBackgroundCompletion:(void (^)(void))completion;
View
2  MagicalRecord/Core/MagicalRecord+Actions.m
@@ -66,7 +66,7 @@ + (void) saveWithBlock:(void (^)(NSManagedObjectContext *localContext))block com
if ([localContext hasChanges])
{
- [localContext MR_saveNestedContextsErrorHandler:errorHandler];
+ [localContext MR_saveErrorHandler:errorHandler];
}
if (completion)
Please sign in to comment.
Something went wrong with that request. Please try again.