Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Using [updatedObject changedValues] rather than -changedValuesForCurr…

…entEvent in order to get correct values

Only sending values for keys with changes in update request
  • Loading branch information...
commit e086f8d31d5ef604d72ca98aa5c04c1871d6bdae 1 parent d5f6912
@mattt mattt authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 AFIncrementalStore/AFRESTClient.m
View
5 AFIncrementalStore/AFRESTClient.m
@@ -253,7 +253,10 @@ - (NSMutableURLRequest *)requestForInsertedObject:(NSManagedObject *)insertedObj
}
- (NSMutableURLRequest *)requestForUpdatedObject:(NSManagedObject *)updatedObject {
- return [self requestWithMethod:@"PUT" path:[self pathForObject:updatedObject] parameters:[self representationOfAttributes:[[updatedObject changedValuesForCurrentEvent] dictionaryWithValuesForKeys:[updatedObject.entity.attributesByName allKeys]] ofManagedObject:updatedObject]];
+ NSMutableSet *mutableChangedAttributeKeys = [NSMutableSet setWithArray:[[updatedObject changedValues] allKeys]];
+ [mutableChangedAttributeKeys intersectSet:[NSSet setWithArray:[updatedObject.entity.attributesByName allKeys]]];
+
+ return [self requestWithMethod:@"PUT" path:[self pathForObject:updatedObject] parameters:[self representationOfAttributes:[[updatedObject changedValues] dictionaryWithValuesForKeys:[mutableChangedAttributeKeys allObjects]] ofManagedObject:updatedObject]];
}
- (NSMutableURLRequest *)requestForDeletedObject:(NSManagedObject *)deletedObject {
Please sign in to comment.
Something went wrong with that request. Please try again.