I can't delete Categories with no Topics in

(Ben M) #1

I saw the earlier discussion Discourse Meta in which a non-zero topic_count field on a Category prevents its deletion. The problem I am seeing is that when I delete all the Topics in a Category (via the rails console - there were a lot of them in this case) the Edit Category dialog is still showing a topic_count greater than zero.

[26] pry(main)> Category.where("name like '%Suitability%'").first.topics
=> []
[27] pry(main)> Category.where("name like '%Suitability%'").first.topic_count
=> 11

I checked and the Jobs::CategoryStats worker has run since I delete the Topics. Have I done something wrong?

(Jeff Atwood) #2

Well at the bottom right it says

Can’t delete this category because the topic count is 11

(Ben M) #3

Sorry, I probably wasn’t clear. My question is why is the topic_count still 11? I’ve deleted the topics and the Jobs::CategoryStats worker has since run.

I can manually update the topic_count of course (via the rails console) but having to do that suggests something else is wrong doesn’t it?

(Jeff Atwood) #4

Well yeah if you are doing stuff at the Rails console, all bets are off…