I am developing an API in Ruby on Rails 3 and in this API I got users and users can be friends. This is handled through Contacts. When a user "asks" for all his or her contacts I create an array that takes the Ids of each user and get the User object for them so that I can get the real name of the contact and not just the contact ID.
This works fine, but I also need the ID of the contact so that I can for example delete contacts in the iPhone app that I am developing. How can I do this? How can the below code be modify to get the contact ID for each user and the user object?
UPDATE
The current JSON output is pastie.org/1848590. I want the contact IDs to be a sub array of the main User object array. Like the latest message is now.
Thankful for all input!