カテゴリ単位での所有者の一括変更

こんにちは。

カテゴリごとに10,000件以上の投稿の所有者を新しいユーザーに一括変更することは可能でしょうか?フォーラムで確認してみましたが、数十件の投稿にしか制限されない一括選択ツールのオプションしか見つかりませんでした。

よろしくお願いします!

ここで見つけました。

このエラーが発生しています。

[1] pry(main)> topics = Topic.where(category_id: categories).pluck(:id)

topics.each do |topic|
  PostOwnerChanger.new(
    post_ids: Post.where(topic_id: topic).where(post_number: 1).pluck(:id),
    topic_id: topic,
[1] pry(main)> topics = Topic.where(category_id: categories).pluck(:id)
topics.each do |topic|urse.system_user,
  PostOwnerChanger.new(
    post_ids: Post.where(topic_id: topic).where(post_number: 1).pluck(:id),
    topic_id: topic,
    new_owner: user,
    acting_user: Discourse.system_user,
    skip_revision: true
  ).change_owner!
NameError: undefined local variable or method `categories' for main:Object
from (pry):1:in `__pry__'
[2] pry(main)>
[3] pry(main)>

まず最初の部分を行う必要があると思います。

フィードバックありがとうございます @JammyDodger

カテゴリIDを指定しましたが、先頭に rails c コマンドを付けるのを忘れました。

あなたの貢献により、コマンドを実行することができました。ありがとうございます!

「いいね!」 1

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.