I'm fetching my friends using the Koala gem for Rails framework like that:

@friends = current_user.facebook.get_connections("me", "friends?fields=id,name,picture.type(small)")

The question is: how do I fetch my friends ordered by name, for example ?

有帮助吗?

解决方案

Use FQL or post process it in Ruby.

So for FQL in Koala, something like

current_user.facebook.fql_query(my_fql_query)

Where my_fql_query is

SELECT uid, name, pic_small FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1=me()) ORDER BY name

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top