Bulk editing Categories


(Heather Dudley) #1

Is there an easy way to bulk edit categories from the admin panel? We’re working on a test site, and of course, I set up differing badge colors for all the categories. I’d like to change them all to roughly the same theme (it won’t be finalized, but this is at the request of beta testers, and I like pretty themes, so.)

Is there an easy way to do this, or do I have to go through and edit each category individually?


(Jay Pfaffman) #2

Not from the UI, but you can do it in the rails console. Here’s an example.

cd /var/discourse
./launcher enter app
rails c
Category.all.update_all(color: "ffe400")
Category.where("name like 'A%'").update_all(color: "00e4ff")
exit
exit

(Heather Dudley) #3

Thanks; I don’t have access to console, but I’ll pass this to IT; honestly, I’ll end up doing it manually; once it’s set, it won’t be needed.