mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-23 12:27:52 +08:00
The RKRailsRouter no longer sends params with delete requests.
The RKObjectLoader will now clean up deleted objects inside of processLoadModelsInBackground:
This commit is contained in:
@@ -169,8 +169,12 @@
|
||||
if (self.targetObject) {
|
||||
if (_targetObjectID) {
|
||||
NSManagedObject* backgroundThreadModel = [self.managedObjectStore objectWithID:_targetObjectID];
|
||||
[_mapper mapObject:backgroundThreadModel fromString:[response bodyAsString]];
|
||||
results = [NSArray arrayWithObject:backgroundThreadModel];
|
||||
if (self.method == RKRequestMethodDELETE) {
|
||||
[[objectStore managedObjectContext] deleteObject:backgroundThreadModel];
|
||||
} else {
|
||||
[_mapper mapObject:backgroundThreadModel fromString:[response bodyAsString]];
|
||||
results = [NSArray arrayWithObject:backgroundThreadModel];
|
||||
}
|
||||
} else {
|
||||
[_mapper mapObject:self.targetObject fromString:[response bodyAsString]];
|
||||
results = [NSArray arrayWithObject:self.targetObject];
|
||||
|
||||
@@ -44,6 +44,11 @@
|
||||
#pragma mark RKRouter
|
||||
|
||||
- (NSObject<RKRequestSerializable>*)serializationForObject:(NSObject<RKObjectMappable>*)object method:(RKRequestMethod)method {
|
||||
// Rails does not send parameters for delete requests.
|
||||
if (method == RKRequestMethodDELETE) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSDictionary* elementsAndProperties = [self elementNamesAndPropertyValuesForObject:object];
|
||||
NSMutableDictionary* resourceParams = [NSMutableDictionary dictionaryWithCapacity:[elementsAndProperties count]];
|
||||
NSString* modelName = [_classToModelMappings objectForKey:[object class]];
|
||||
|
||||
Reference in New Issue
Block a user