我们必须将 twitter_oauth gem 更新到 v.0.4.9 以支持 Twitter 的新 1.1 API。但是,收藏帖子和关注用户不起作用。尝试关注用户或收藏帖子时出现返回错误,如下所示:
{"errors"=>[{"message"=>"Sorry, that page does not exist", "code"=>34}]}
我有一个具有以下内容的 api_client 模型:
def follow(id)
client.friend(id)
end
我的控制器代码:
def update
status = if params[:follow]
client.follow(params[:id])
elsif params[:follow] == 'false'
client.follow(params[:id])
end
respond_to do |format|
format.json do
if status['screen_name'] == params[:screen_name]
success = true
notice = if params[:follow] == 'true'
"You are now following #{status['screen_name']}"
else
"You are no longer following #{status['screen_name']}"
end
else
success = false
notice = 'Something went wrong. Try again in a couple of seconds.'
end
render :json => {:success => success, :message => notice}.to_json
end
end
end
有没有其他人遇到过这个问题或者可以帮助我弄清楚发生了什么?