Updated to support setting default value instead of nil when an attribute is missing in the payload. For Core Data backed models, we consult the entity definition to obtain the default value. closes #117

This commit is contained in:
Blake Watters
2011-06-28 15:22:04 -04:00
parent 851df3bcba
commit 3dfbaf1810
11 changed files with 47 additions and 18 deletions

View File

@@ -18,7 +18,7 @@ NSString* const RKObjectMappingNestingAttributeKeyName = @"<RK_NESTING_ATTRIBUTE
@synthesize mappings = _mappings;
@synthesize dateFormatStrings = _dateFormatStrings;
@synthesize rootKeyPath = _rootKeyPath;
@synthesize setNilForMissingAttributes = _setNilForMissingAttributes;
@synthesize setDefaultValueForMissingAttributes = _setDefaultValueForMissingAttributes;
@synthesize setNilForMissingRelationships = _setNilForMissingRelationships;
@synthesize forceCollectionMapping = _forceCollectionMapping;
@@ -33,7 +33,7 @@ NSString* const RKObjectMappingNestingAttributeKeyName = @"<RK_NESTING_ATTRIBUTE
if (self) {
_mappings = [NSMutableArray new];
_dateFormatStrings = [[NSMutableArray alloc] initWithObjects:@"yyyy-MM-dd'T'HH:mm:ss'Z'", @"MM/dd/yyyy", nil];
self.setNilForMissingAttributes = NO;
self.setDefaultValueForMissingAttributes = NO;
self.setNilForMissingRelationships = NO;
self.forceCollectionMapping = NO;
}
@@ -214,4 +214,8 @@ NSString* const RKObjectMappingNestingAttributeKeyName = @"<RK_NESTING_ATTRIBUTE
return nil;
}
- (id)defaultValueForMissingAttribute:(NSString*)attributeName {
return nil;
}
@end