I would like to take bulk action to delete all post with missing upload image:
> rake posts:missing_uploads 70782 post uploads are missing. 61037 uploads are missing. 23249 of 216049 posts are affected.
> PostCustomField.where(name: Post::MISSING_UPLOADS).count ===> 23249
So I decide to delete all of them with below code on rails c
> rails c > PostCustomField.where(name: Post::MISSING_UPLOADS).find_each do |post| > PostDestroyer.new(Discourse.system_user, post).destroy > end
But no luck with error show as below:
NoMethodError: undefined method `topic' for #<PostCustomField:0x000055dd7425e160> from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activemodel-184.108.40.206/lib/active_model/attribute_methods.rb:469:in `method_missing'
I would like to looking for some help in this case to bulk destroy missing upload topic