1
我有一種方法,跟隨另一個Twitter用戶,自動授權後,使用Twitter的寶石。這工作:Twitter的寶石跟蹤方法在軌道3.1應用程序
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的手柄。它存儲在數據庫中,但可能沒有正確加載?我在Authorizations
模型上使用after_save
呼叫。
我也試過
def follow_us
unless Twitter.friendship_exists?("boxfirepress", self.nickname)
Twitter.follow("boxfirepress")
end
end
但沒有工作,要麼。我也試過self.uid
來代替暱稱。