I'm using the gem Koala to get facebook friends.
How to relate these results to the users of the database ?
code
facebook = Koala::Facebook::API.new(params[:facebook_access_token])
friends = facebook.get_connections("me", "friends")
return
[
{
"name": "Mick Fanning",
"id": "9523891481361"
},
{
"name": "Gabriel Medina",
"id": "9523891483211"
}
]
Idea:
join = friends.map {|u| {
:user => user = User.where(provider_uid: u['id']).first,
:provider_uid => u['id'],
:name => u['name']
}}
This will generate lots of queries...
How do i join the two records and return the table data?
Anyway, it seems I got your need. Do the query first.