您好,
是否可以按类别批量更改 10,000 多个帖子的所有权给新用户?我尝试在论坛上查看,但只看到了批量选择工具的选项,该工具仅限于十几篇帖子。
谢谢!
您好,
是否可以按类别批量更改 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 命令。
您的贡献使我们能够执行该命令。谢谢!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.