In my model i'm getting two Json arrays from both the facebook's and twitter's api.
facebook_friends = { "data":
[{"name": "Friend Joe", "id": "123"},
{"name": "Friend Jane", "id": "12342"}]}
twitter_friends = { "users":
[{"name": "Other friend joe", "id": "333"},
{"name": "Other friend Jane", "id": "456"}]}
And I want to build an array like this (NB: i'm appending the provider key to identify the source of the data)
all_friends = [
{"name": "Friend Joe", "id": "123", "provider": "facebook"},
{"name": "Friend Jane", "id": "12342", "provider": "facebook"},
{"name": "Other friend joe", "id": "333", "provider": "twitter"},
{"name": "Other friend Jane", "id": "456", "provider": "twitter"}]
I can do this with jquery like this -> http://jsfiddle.net/gm3jJ/ but how do i do it in ruby?
Thanks