next_cursor == 0 までカーソルのページをループして機能するコードがありましたが、その後、他の問題が発生したため、以前のコミットに戻ることにしました。今でも同じコードを使用していますが、機能しません。@cursor を next_cursor_str の値に設定しますが、ループは nil を返し、結果の最初のページのみが保存されます。
class FollowersController < ApplicationController
def create
@cursor = "-1"
until @cursor == "0"
follower_info = current_user.twitter.followers(cursor: @cursor).attrs
@cursor = follower_info[:next_cursor_str]
follower_info[:users].each do |follower|
current_user.followers.build(
fid: follower[:id_str],
name: follower[:screen_name]
)
end
end
current_user.save
redirect_to action: 'static_pages#home'
end
end