0

我已经安装了 gemkoalaomniauth. 在我的user模型中

class User < ActiveRecord::Base
def self.from_omniauth(auth)
where(auth.slice(:provider, :uid)).first_or_initialize.tap do |user|
  user.provider = auth.provider
  user.uid = auth.uid
  user.name = auth.info.name
  user.image = auth.info.image
  user.oauth_token = auth.credentials.token
  user.oauth_expires_at = Time.at(auth.credentials.expires_at)
  user.save!
end
end

def facebook
  @facebook ||= Koala::Facebook::API.new(oauth_token)
end

end

我已经获得了 facebook 的许可,但我仍然无法获得关系状态?

4

1 回答 1

2

尝试这个

@facebook.get_object('me',:fields=>"name,gender,relationship_status")
于 2013-01-28T14:07:49.273 回答