Yeah. It worked on most of the posts. There’s something funky with some of them.
[63] pry(main)> post.topic_id
=> 179227
[64] pry(main)> post.topic
=> nil
[65] pry(main)>
I’m pretty sure that’s not supposed to happen. ![]()
But wait:
Topic.find(post.topic_id)
ActiveRecord::RecordNotFound: Couldn't find Topic with 'id'=179227 [WHERE "topics"."deleted_at" IS NULL]
from /var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/relation/finder_methods.rb:428:in `raise_record_not_found_exception!'
The topic is deleted.
So then the question is whether it’s a bug that you can’t revise posts in deleted topics.
I guess I’m not going to care and have my script check post.topic for nil rather than post.topic_id