我有一个方法可以使用 Twitter gem 在授权后自动跟踪另一个 Twitter 用户。这有效:
def follow_us
Twitter.follow("boxfirepress")
end
不过,我想检查并确保该用户尚未被关注。我似乎无法使条件句正确。
我试过:
def follow_us
Twitter.follow("boxfirepress") unless Twitter.friendship_exists?("boxfirepress", self.nickname)
end
self.nickname
在oauth 过程中捕获的 twitter 句柄应该在哪里。它存储在数据库中,但可能没有正确加载?我正在对模型进行after_save
调用。Authorizations
我也试过
def follow_us
unless Twitter.friendship_exists?("boxfirepress", self.nickname)
Twitter.follow("boxfirepress")
end
end
但这也不起作用。我也试过self.uid
代替昵称。