Last active
June 17, 2020 21:13
-
-
Save ashfurrow/3c787f6f1125158f254e26aac593b613 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove old followers | |
account = Account.find(1) # that's me babey | |
scope = account.followers.eager_load(:account_stat).reorder(nil) | |
scope.merge! Account.by_recent_status | |
scope.merge! Account.local | |
scope.merge! AccountStat.where(last_status_at: nil).or(AccountStat.where(AccountStat.arel_table[:last_status_at].lt(6.months.ago))) | |
scope.count # 13146 | |
account.passive_relationships.where(account_id: scope.pluck(:id)).find_each do |follow| | |
follow.destroy | |
puts follow.account_id | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment