Skip to content

Commit

Permalink
Preventing duplicate pro to records for relationship proto records
Browse files Browse the repository at this point in the history
  • Loading branch information
Conrad Stoll committed Feb 27, 2014
1 parent 63c24c4 commit 1735561
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
//[MMJSONServer registerResourceName:@"posts" forPathComponent:@"posts"];
//[ADNRecord registerServerClass:[MMJSONServer class]];

[MMRecord setLoggingLevel:MMRecordLoggingLevelInfo];
[MMRecord setLoggingLevel:MMRecordLoggingLevelDebug];

return YES;
}
Expand Down
6 changes: 5 additions & 1 deletion Source/MMRecord/MMRecordProtoRecord.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ - (void)addRelationshipProto:(MMRecordProtoRecord *)relationshipProto
protoSet = [NSMutableOrderedSet orderedSet];
}

[protoSet addObject:relationshipProto];
if ([relationshipDescription isToMany] == NO && [protoSet count] >= 1) {
// Ignore this relationshipProto because its a duplicate
} else {
[protoSet addObject:relationshipProto];
}

[self.relationshipProtosDictionary setValue:protoSet forKey:relationshipName];
}
Expand Down

0 comments on commit 1735561

Please sign in to comment.