Q:

Restkit 0.20: Customising what is sent to the server on PUT/POST with foreign key relationships

e.g. if I have the following entities
User = ['ident' => NSUInteger, 'username' => NSString, 'name' => NSString, 'email' => NSString]
Comment = ['ident' => NSUInteger, 'user' => User, 'message' => NSString]

If I then post a Comment to the server RESTKit will send this as follows:
{
    'ident': ...,
    'user': {
        'ident': ...,
        'username': ...,
        'name': ...,
        'email': ...
    },
    'message': ...
}

When really all I need to hook up the foreign keys server side is the following:
{
    'ident': ...,
    'user': {
        'ident': ...  
    },
    'message': ...
}

Is there anyway to configure RESTKit in such a way - e.g. the request descriptor - that it only maps a subset of the the attributes of objects within relations? As of yet I haven't been able to find such a feature but would like to avoid having to hack at RESTKit itself to perform this...

A:

Exactly, it's the mapping you use with the request descriptor. I guess you're using inverseMapping? But you don't need to, you can create a new mapping with only the parts you need. You can even use key paths to navigate to the user and extract the ident without needing to add any nesting into the generated JSON.

