Skip to content

Commit

Permalink
saveWithBlock was not saving parent contexts
Browse files Browse the repository at this point in the history
This makes the saveWithBlock method consistent with it's background
siblings.
  • Loading branch information
tonyarnold authored and blackgold9 committed Oct 16, 2012
1 parent 835b467 commit 870ca22
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion MagicalRecord/Core/MagicalRecord+Actions.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ + (void) saveWithBlock:(void (^)(NSManagedObjectContext *localContext))block com

if ([localContext hasChanges])
{
[localContext MR_saveNestedContextsErrorHandler:errorHandler];
[localContext MR_saveErrorHandler:errorHandler];
}

if (completion)
Expand Down

0 comments on commit 870ca22

Please sign in to comment.