Last active
December 17, 2015 20:49
-
-
Save koloritcm/5670284 to your computer and use it in GitHub Desktop.
Sharing parent value when mapping a list of objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// { | |
// "category": "MyCategory" | |
// "items": [ | |
// { "id": 1, "name": "A" }, | |
// { "id": 2, "name": "B" }, | |
// { "id": 3, "name": "C" } | |
// ] | |
// } | |
// Current mapping, but missing "category" object that should be mapped to each "Item" | |
RKEntityMapping *mapping = [RKEntityMapping mappingForEntityForName:@"Item" inManagedObjectStore:manager.managedObjectStore]; | |
mapping.identificationAttributes = @[ @"id" ]; | |
[mapping addAttributeMappingsFromDictionary:@{ @"name": @"name" }]; | |
// TODO: Also add "category" to this mapping |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment